repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
sstrickx/yahoofinance-api
src/main/java/yahoofinance/exchanges/ExchangeTimeZone.java
ExchangeTimeZone.get
public static TimeZone get(String suffix) { if(SUFFIX_TIMEZONES.containsKey(suffix)) { return SUFFIX_TIMEZONES.get(suffix); } log.warn("Cannot find time zone for exchange suffix: '{}'. Using default: America/New_York", suffix); return SUFFIX_TIMEZONES.get(""); }
java
public static TimeZone get(String suffix) { if(SUFFIX_TIMEZONES.containsKey(suffix)) { return SUFFIX_TIMEZONES.get(suffix); } log.warn("Cannot find time zone for exchange suffix: '{}'. Using default: America/New_York", suffix); return SUFFIX_TIMEZONES.get(""); }
[ "public", "static", "TimeZone", "get", "(", "String", "suffix", ")", "{", "if", "(", "SUFFIX_TIMEZONES", ".", "containsKey", "(", "suffix", ")", ")", "{", "return", "SUFFIX_TIMEZONES", ".", "get", "(", "suffix", ")", ";", "}", "log", ".", "warn", "(", ...
Get the time zone for a specific exchange suffix @param suffix suffix for the exchange in YahooFinance @return time zone of the exchange
[ "Get", "the", "time", "zone", "for", "a", "specific", "exchange", "suffix" ]
2766ba52fc5cccf9b4da5c06423d68059cf0a6e6
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/exchanges/ExchangeTimeZone.java#L168-L174
train
sstrickx/yahoofinance-api
src/main/java/yahoofinance/exchanges/ExchangeTimeZone.java
ExchangeTimeZone.getStockTimeZone
public static TimeZone getStockTimeZone(String symbol) { // First check if it's a known stock index if(INDEX_TIMEZONES.containsKey(symbol)) { return INDEX_TIMEZONES.get(symbol); } if(!symbol.contains(".")) { return ExchangeTimeZone.get(""); } String[] split = symbol.split("\\."); return ExchangeTimeZone.get(split[split.length - 1]); }
java
public static TimeZone getStockTimeZone(String symbol) { // First check if it's a known stock index if(INDEX_TIMEZONES.containsKey(symbol)) { return INDEX_TIMEZONES.get(symbol); } if(!symbol.contains(".")) { return ExchangeTimeZone.get(""); } String[] split = symbol.split("\\."); return ExchangeTimeZone.get(split[split.length - 1]); }
[ "public", "static", "TimeZone", "getStockTimeZone", "(", "String", "symbol", ")", "{", "// First check if it's a known stock index", "if", "(", "INDEX_TIMEZONES", ".", "containsKey", "(", "symbol", ")", ")", "{", "return", "INDEX_TIMEZONES", ".", "get", "(", "symbol...
Get the time zone for a specific stock or index. For stocks, the exchange suffix is extracted from the stock symbol to retrieve the time zone. @param symbol stock symbol in YahooFinance @return time zone of the exchange on which this stock is traded
[ "Get", "the", "time", "zone", "for", "a", "specific", "stock", "or", "index", ".", "For", "stocks", "the", "exchange", "suffix", "is", "extracted", "from", "the", "stock", "symbol", "to", "retrieve", "the", "time", "zone", "." ]
2766ba52fc5cccf9b4da5c06423d68059cf0a6e6
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/exchanges/ExchangeTimeZone.java#L183-L194
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/ui/builder/VideoRendererBuilder.java
VideoRendererBuilder.getPrototypeClass
@Override protected Class getPrototypeClass(Video content) { Class prototypeClass; if (content.isFavorite()) { prototypeClass = FavoriteVideoRenderer.class; } else if (content.isLive()) { prototypeClass = LiveVideoRenderer.class; } else { prototypeClass = LikeVideoRenderer.class; } return prototypeClass; }
java
@Override protected Class getPrototypeClass(Video content) { Class prototypeClass; if (content.isFavorite()) { prototypeClass = FavoriteVideoRenderer.class; } else if (content.isLive()) { prototypeClass = LiveVideoRenderer.class; } else { prototypeClass = LikeVideoRenderer.class; } return prototypeClass; }
[ "@", "Override", "protected", "Class", "getPrototypeClass", "(", "Video", "content", ")", "{", "Class", "prototypeClass", ";", "if", "(", "content", ".", "isFavorite", "(", ")", ")", "{", "prototypeClass", "=", "FavoriteVideoRenderer", ".", "class", ";", "}", ...
Method to declare Video-VideoRenderer mapping. Favorite videos will be rendered using FavoriteVideoRenderer. Live videos will be rendered using LiveVideoRenderer. Liked videos will be rendered using LikeVideoRenderer. @param content used to map object-renderers. @return VideoRenderer subtype class.
[ "Method", "to", "declare", "Video", "-", "VideoRenderer", "mapping", ".", "Favorite", "videos", "will", "be", "rendered", "using", "FavoriteVideoRenderer", ".", "Live", "videos", "will", "be", "rendered", "using", "LiveVideoRenderer", ".", "Liked", "videos", "will...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/ui/builder/VideoRendererBuilder.java#L49-L59
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java
RVRendererAdapter.getItemViewType
@Override public int getItemViewType(int position) { T content = getItem(position); return rendererBuilder.getItemViewType(content); }
java
@Override public int getItemViewType(int position) { T content = getItem(position); return rendererBuilder.getItemViewType(content); }
[ "@", "Override", "public", "int", "getItemViewType", "(", "int", "position", ")", "{", "T", "content", "=", "getItem", "(", "position", ")", ";", "return", "rendererBuilder", ".", "getItemViewType", "(", "content", ")", ";", "}" ]
Indicate to the RecyclerView the type of Renderer used to one position using a numeric value. @param position to analyze. @return the id associated to the Renderer used to render the content given a position.
[ "Indicate", "to", "the", "RecyclerView", "the", "type", "of", "Renderer", "used", "to", "one", "position", "using", "a", "numeric", "value", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L81-L84
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java
RVRendererAdapter.onCreateViewHolder
@Override public RendererViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { rendererBuilder.withParent(viewGroup); rendererBuilder.withLayoutInflater(LayoutInflater.from(viewGroup.getContext())); rendererBuilder.withViewType(viewType); RendererViewHolder viewHolder = rendererBuilder.buildRendererViewHolder(); if (viewHolder == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null viewHolder"); } return viewHolder; }
java
@Override public RendererViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { rendererBuilder.withParent(viewGroup); rendererBuilder.withLayoutInflater(LayoutInflater.from(viewGroup.getContext())); rendererBuilder.withViewType(viewType); RendererViewHolder viewHolder = rendererBuilder.buildRendererViewHolder(); if (viewHolder == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null viewHolder"); } return viewHolder; }
[ "@", "Override", "public", "RendererViewHolder", "onCreateViewHolder", "(", "ViewGroup", "viewGroup", ",", "int", "viewType", ")", "{", "rendererBuilder", ".", "withParent", "(", "viewGroup", ")", ";", "rendererBuilder", ".", "withLayoutInflater", "(", "LayoutInflater...
One of the two main methods in this class. Creates a RendererViewHolder instance with a Renderer inside ready to be used. The RendererBuilder to create a RendererViewHolder using the information given as parameter. @param viewGroup used to create the ViewHolder. @param viewType associated to the renderer. @return ViewHolder extension with the Renderer it has to use inside.
[ "One", "of", "the", "two", "main", "methods", "in", "this", "class", ".", "Creates", "a", "RendererViewHolder", "instance", "with", "a", "Renderer", "inside", "ready", "to", "be", "used", ".", "The", "RendererBuilder", "to", "create", "a", "RendererViewHolder"...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L95-L104
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java
RVRendererAdapter.onBindViewHolder
@Override public void onBindViewHolder(RendererViewHolder viewHolder, int position) { T content = getItem(position); Renderer<T> renderer = viewHolder.getRenderer(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null renderer"); } renderer.setContent(content); updateRendererExtraValues(content, renderer, position); renderer.render(); }
java
@Override public void onBindViewHolder(RendererViewHolder viewHolder, int position) { T content = getItem(position); Renderer<T> renderer = viewHolder.getRenderer(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null renderer"); } renderer.setContent(content); updateRendererExtraValues(content, renderer, position); renderer.render(); }
[ "@", "Override", "public", "void", "onBindViewHolder", "(", "RendererViewHolder", "viewHolder", ",", "int", "position", ")", "{", "T", "content", "=", "getItem", "(", "position", ")", ";", "Renderer", "<", "T", ">", "renderer", "=", "viewHolder", ".", "getRe...
Given a RendererViewHolder passed as argument and a position renders the view using the Renderer previously stored into the RendererViewHolder. @param viewHolder with a Renderer class inside. @param position to render.
[ "Given", "a", "RendererViewHolder", "passed", "as", "argument", "and", "a", "position", "renders", "the", "view", "using", "the", "Renderer", "previously", "stored", "into", "the", "RendererViewHolder", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L113-L122
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java
RVRendererAdapter.diffUpdate
public void diffUpdate(List<T> newList) { if (getCollection().size() == 0) { addAll(newList); notifyDataSetChanged(); } else { DiffCallback diffCallback = new DiffCallback(collection, newList); DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback); clear(); addAll(newList); diffResult.dispatchUpdatesTo(this); } }
java
public void diffUpdate(List<T> newList) { if (getCollection().size() == 0) { addAll(newList); notifyDataSetChanged(); } else { DiffCallback diffCallback = new DiffCallback(collection, newList); DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback); clear(); addAll(newList); diffResult.dispatchUpdatesTo(this); } }
[ "public", "void", "diffUpdate", "(", "List", "<", "T", ">", "newList", ")", "{", "if", "(", "getCollection", "(", ")", ".", "size", "(", ")", "==", "0", ")", "{", "addAll", "(", "newList", ")", ";", "notifyDataSetChanged", "(", ")", ";", "}", "else...
Provides a ready to use diff update for our adapter based on the implementation of the standard equals method from Object. @param newList to refresh our content
[ "Provides", "a", "ready", "to", "use", "diff", "update", "for", "our", "adapter", "based", "on", "the", "implementation", "of", "the", "standard", "equals", "method", "from", "Object", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L201-L212
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.withPrototype
public RendererBuilder<T> withPrototype(Renderer<? extends T> renderer) { if (renderer == null) { throw new NeedsPrototypesException( "RendererBuilder can't use a null Renderer<T> instance as prototype"); } this.prototypes.add(renderer); return this; }
java
public RendererBuilder<T> withPrototype(Renderer<? extends T> renderer) { if (renderer == null) { throw new NeedsPrototypesException( "RendererBuilder can't use a null Renderer<T> instance as prototype"); } this.prototypes.add(renderer); return this; }
[ "public", "RendererBuilder", "<", "T", ">", "withPrototype", "(", "Renderer", "<", "?", "extends", "T", ">", "renderer", ")", "{", "if", "(", "renderer", "==", "null", ")", "{", "throw", "new", "NeedsPrototypesException", "(", "\"RendererBuilder can't use a null...
Add a Renderer instance as prototype. @param renderer to use as prototype. @return the current RendererBuilder instance.
[ "Add", "a", "Renderer", "instance", "as", "prototype", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L134-L141
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.bind
public <G extends T> RendererBuilder<T> bind(Class<G> clazz, Renderer<? extends G> prototype) { if (clazz == null || prototype == null) { throw new IllegalArgumentException( "The binding RecyclerView binding can't be configured using null instances"); } prototypes.add(prototype); binding.put(clazz, prototype.getClass()); return this; }
java
public <G extends T> RendererBuilder<T> bind(Class<G> clazz, Renderer<? extends G> prototype) { if (clazz == null || prototype == null) { throw new IllegalArgumentException( "The binding RecyclerView binding can't be configured using null instances"); } prototypes.add(prototype); binding.put(clazz, prototype.getClass()); return this; }
[ "public", "<", "G", "extends", "T", ">", "RendererBuilder", "<", "T", ">", "bind", "(", "Class", "<", "G", ">", "clazz", ",", "Renderer", "<", "?", "extends", "G", ">", "prototype", ")", "{", "if", "(", "clazz", "==", "null", "||", "prototype", "==...
Given a class configures the binding between a class and a Renderer class. @param clazz to bind. @param prototype used as Renderer. @return the current RendererBuilder instance.
[ "Given", "a", "class", "configures", "the", "binding", "between", "a", "class", "and", "a", "Renderer", "class", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L150-L158
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.getItemViewType
int getItemViewType(T content) { Class prototypeClass = getPrototypeClass(content); validatePrototypeClass(prototypeClass); return getItemViewType(prototypeClass); }
java
int getItemViewType(T content) { Class prototypeClass = getPrototypeClass(content); validatePrototypeClass(prototypeClass); return getItemViewType(prototypeClass); }
[ "int", "getItemViewType", "(", "T", "content", ")", "{", "Class", "prototypeClass", "=", "getPrototypeClass", "(", "content", ")", ";", "validatePrototypeClass", "(", "prototypeClass", ")", ";", "return", "getItemViewType", "(", "prototypeClass", ")", ";", "}" ]
Return the item view type used by the adapter to implement recycle mechanism. @param content to be rendered. @return an integer that represents the renderer inside the adapter.
[ "Return", "the", "item", "view", "type", "used", "by", "the", "adapter", "to", "implement", "recycle", "mechanism", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L200-L204
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.build
protected Renderer build() { validateAttributes(); Renderer renderer; if (isRecyclable(convertView, content)) { renderer = recycle(convertView, content); } else { renderer = createRenderer(content, parent); } return renderer; }
java
protected Renderer build() { validateAttributes(); Renderer renderer; if (isRecyclable(convertView, content)) { renderer = recycle(convertView, content); } else { renderer = createRenderer(content, parent); } return renderer; }
[ "protected", "Renderer", "build", "(", ")", "{", "validateAttributes", "(", ")", ";", "Renderer", "renderer", ";", "if", "(", "isRecyclable", "(", "convertView", ",", "content", ")", ")", "{", "renderer", "=", "recycle", "(", "convertView", ",", "content", ...
Main method of this class related to ListView widget. This method is the responsible of recycle or create a new Renderer instance with all the needed information to implement the rendering. This method will validate all the attributes passed in the builder constructor and will check if can recycle or has to create a new Renderer instance. This method is used with ListView because the view recycling mechanism is implemented in this class. RecyclerView widget will use buildRendererViewHolder method. @return ready to use Renderer instance.
[ "Main", "method", "of", "this", "class", "related", "to", "ListView", "widget", ".", "This", "method", "is", "the", "responsible", "of", "recycle", "or", "create", "a", "new", "Renderer", "instance", "with", "all", "the", "needed", "information", "to", "impl...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L227-L237
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.buildRendererViewHolder
protected RendererViewHolder buildRendererViewHolder() { validateAttributesToCreateANewRendererViewHolder(); Renderer renderer = getPrototypeByIndex(viewType).copy(); renderer.onCreate(null, layoutInflater, parent); return new RendererViewHolder(renderer); }
java
protected RendererViewHolder buildRendererViewHolder() { validateAttributesToCreateANewRendererViewHolder(); Renderer renderer = getPrototypeByIndex(viewType).copy(); renderer.onCreate(null, layoutInflater, parent); return new RendererViewHolder(renderer); }
[ "protected", "RendererViewHolder", "buildRendererViewHolder", "(", ")", "{", "validateAttributesToCreateANewRendererViewHolder", "(", ")", ";", "Renderer", "renderer", "=", "getPrototypeByIndex", "(", "viewType", ")", ".", "copy", "(", ")", ";", "renderer", ".", "onCr...
Main method of this class related to RecyclerView widget. This method is the responsible of create a new Renderer instance with all the needed information to implement the rendering. This method will validate all the attributes passed in the builder constructor and will create a RendererViewHolder instance. This method is used with RecyclerView because the view recycling mechanism is implemented out of this class and we only have to return new RendererViewHolder instances. @return ready to use RendererViewHolder instance.
[ "Main", "method", "of", "this", "class", "related", "to", "RecyclerView", "widget", ".", "This", "method", "is", "the", "responsible", "of", "create", "a", "new", "Renderer", "instance", "with", "all", "the", "needed", "information", "to", "implement", "the", ...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L250-L256
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.recycle
private Renderer recycle(View convertView, T content) { Renderer renderer = (Renderer) convertView.getTag(); renderer.onRecycle(content); return renderer; }
java
private Renderer recycle(View convertView, T content) { Renderer renderer = (Renderer) convertView.getTag(); renderer.onRecycle(content); return renderer; }
[ "private", "Renderer", "recycle", "(", "View", "convertView", ",", "T", "content", ")", "{", "Renderer", "renderer", "=", "(", "Renderer", ")", "convertView", ".", "getTag", "(", ")", ";", "renderer", ".", "onRecycle", "(", "content", ")", ";", "return", ...
Recycles the Renderer getting it from the tag associated to the renderer root view. This view is not used with RecyclerView widget. @param convertView that contains the tag. @param content to be updated in the recycled renderer. @return a recycled renderer.
[ "Recycles", "the", "Renderer", "getting", "it", "from", "the", "tag", "associated", "to", "the", "renderer", "root", "view", ".", "This", "view", "is", "not", "used", "with", "RecyclerView", "widget", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L266-L270
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.createRenderer
private Renderer createRenderer(T content, ViewGroup parent) { int prototypeIndex = getPrototypeIndex(content); Renderer renderer = getPrototypeByIndex(prototypeIndex).copy(); renderer.onCreate(content, layoutInflater, parent); return renderer; }
java
private Renderer createRenderer(T content, ViewGroup parent) { int prototypeIndex = getPrototypeIndex(content); Renderer renderer = getPrototypeByIndex(prototypeIndex).copy(); renderer.onCreate(content, layoutInflater, parent); return renderer; }
[ "private", "Renderer", "createRenderer", "(", "T", "content", ",", "ViewGroup", "parent", ")", "{", "int", "prototypeIndex", "=", "getPrototypeIndex", "(", "content", ")", ";", "Renderer", "renderer", "=", "getPrototypeByIndex", "(", "prototypeIndex", ")", ".", ...
Create a Renderer getting a copy from the prototypes collection. @param content to render. @param parent used to inflate the view. @return a new renderer.
[ "Create", "a", "Renderer", "getting", "a", "copy", "from", "the", "prototypes", "collection", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L279-L284
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.getPrototypeByIndex
private Renderer getPrototypeByIndex(final int prototypeIndex) { Renderer prototypeSelected = null; int i = 0; for (Renderer prototype : prototypes) { if (i == prototypeIndex) { prototypeSelected = prototype; } i++; } return prototypeSelected; }
java
private Renderer getPrototypeByIndex(final int prototypeIndex) { Renderer prototypeSelected = null; int i = 0; for (Renderer prototype : prototypes) { if (i == prototypeIndex) { prototypeSelected = prototype; } i++; } return prototypeSelected; }
[ "private", "Renderer", "getPrototypeByIndex", "(", "final", "int", "prototypeIndex", ")", "{", "Renderer", "prototypeSelected", "=", "null", ";", "int", "i", "=", "0", ";", "for", "(", "Renderer", "prototype", ":", "prototypes", ")", "{", "if", "(", "i", "...
Search one prototype using the prototype index which is equals to the view type. This method has to be implemented because prototypes member is declared with Collection and that interface doesn't allow the client code to get one element by index. @param prototypeIndex used to search. @return prototype renderer.
[ "Search", "one", "prototype", "using", "the", "prototype", "index", "which", "is", "equals", "to", "the", "view", "type", ".", "This", "method", "has", "to", "be", "implemented", "because", "prototypes", "member", "is", "declared", "with", "Collection", "and",...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L294-L304
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.isRecyclable
private boolean isRecyclable(View convertView, T content) { boolean isRecyclable = false; if (convertView != null && convertView.getTag() != null) { Class prototypeClass = getPrototypeClass(content); validatePrototypeClass(prototypeClass); isRecyclable = prototypeClass.equals(convertView.getTag().getClass()); } return isRecyclable; }
java
private boolean isRecyclable(View convertView, T content) { boolean isRecyclable = false; if (convertView != null && convertView.getTag() != null) { Class prototypeClass = getPrototypeClass(content); validatePrototypeClass(prototypeClass); isRecyclable = prototypeClass.equals(convertView.getTag().getClass()); } return isRecyclable; }
[ "private", "boolean", "isRecyclable", "(", "View", "convertView", ",", "T", "content", ")", "{", "boolean", "isRecyclable", "=", "false", ";", "if", "(", "convertView", "!=", "null", "&&", "convertView", ".", "getTag", "(", ")", "!=", "null", ")", "{", "...
Check if one Renderer is recyclable getting it from the convertView's tag and checking the class used. @param convertView to get the renderer if is not null. @param content used to get the prototype class. @return true if the renderer is recyclable.
[ "Check", "if", "one", "Renderer", "is", "recyclable", "getting", "it", "from", "the", "convertView", "s", "tag", "and", "checking", "the", "class", "used", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L314-L322
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.getItemViewType
private int getItemViewType(Class prototypeClass) { int itemViewType = -1; for (Renderer renderer : prototypes) { if (renderer.getClass().equals(prototypeClass)) { itemViewType = getPrototypeIndex(renderer); break; } } if (itemViewType == -1) { throw new PrototypeNotFoundException( "Review your RendererBuilder implementation, you are returning one" + " prototype class not found in prototypes collection"); } return itemViewType; }
java
private int getItemViewType(Class prototypeClass) { int itemViewType = -1; for (Renderer renderer : prototypes) { if (renderer.getClass().equals(prototypeClass)) { itemViewType = getPrototypeIndex(renderer); break; } } if (itemViewType == -1) { throw new PrototypeNotFoundException( "Review your RendererBuilder implementation, you are returning one" + " prototype class not found in prototypes collection"); } return itemViewType; }
[ "private", "int", "getItemViewType", "(", "Class", "prototypeClass", ")", "{", "int", "itemViewType", "=", "-", "1", ";", "for", "(", "Renderer", "renderer", ":", "prototypes", ")", "{", "if", "(", "renderer", ".", "getClass", "(", ")", ".", "equals", "(...
Return the Renderer class associated to the prototype. @param prototypeClass used to search the renderer in the prototypes collection. @return the prototype index associated to the prototypeClass.
[ "Return", "the", "Renderer", "class", "associated", "to", "the", "prototype", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L347-L361
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.getPrototypeIndex
private int getPrototypeIndex(Renderer renderer) { int index = 0; for (Renderer prototype : prototypes) { if (prototype.getClass().equals(renderer.getClass())) { break; } index++; } return index; }
java
private int getPrototypeIndex(Renderer renderer) { int index = 0; for (Renderer prototype : prototypes) { if (prototype.getClass().equals(renderer.getClass())) { break; } index++; } return index; }
[ "private", "int", "getPrototypeIndex", "(", "Renderer", "renderer", ")", "{", "int", "index", "=", "0", ";", "for", "(", "Renderer", "prototype", ":", "prototypes", ")", "{", "if", "(", "prototype", ".", "getClass", "(", ")", ".", "equals", "(", "rendere...
Return the index associated to the Renderer. @param renderer used to search in the prototypes collection. @return the prototype index associated to the renderer passed as argument.
[ "Return", "the", "index", "associated", "to", "the", "Renderer", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L369-L378
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.validateAttributes
private void validateAttributes() { if (content == null) { throw new NullContentException("RendererBuilder needs content to create Renderer instances"); } if (parent == null) { throw new NullParentException("RendererBuilder needs a parent to inflate Renderer instances"); } if (layoutInflater == null) { throw new NullLayoutInflaterException( "RendererBuilder needs a LayoutInflater to inflate Renderer instances"); } }
java
private void validateAttributes() { if (content == null) { throw new NullContentException("RendererBuilder needs content to create Renderer instances"); } if (parent == null) { throw new NullParentException("RendererBuilder needs a parent to inflate Renderer instances"); } if (layoutInflater == null) { throw new NullLayoutInflaterException( "RendererBuilder needs a LayoutInflater to inflate Renderer instances"); } }
[ "private", "void", "validateAttributes", "(", ")", "{", "if", "(", "content", "==", "null", ")", "{", "throw", "new", "NullContentException", "(", "\"RendererBuilder needs content to create Renderer instances\"", ")", ";", "}", "if", "(", "parent", "==", "null", "...
Throws one RendererException if the content parent or layoutInflater are null.
[ "Throws", "one", "RendererException", "if", "the", "content", "parent", "or", "layoutInflater", "are", "null", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L383-L396
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.validateAttributesToCreateANewRendererViewHolder
private void validateAttributesToCreateANewRendererViewHolder() { if (viewType == null) { throw new NullContentException( "RendererBuilder needs a view type to create a RendererViewHolder"); } if (layoutInflater == null) { throw new NullLayoutInflaterException( "RendererBuilder needs a LayoutInflater to create a RendererViewHolder"); } if (parent == null) { throw new NullParentException( "RendererBuilder needs a parent to create a RendererViewHolder"); } }
java
private void validateAttributesToCreateANewRendererViewHolder() { if (viewType == null) { throw new NullContentException( "RendererBuilder needs a view type to create a RendererViewHolder"); } if (layoutInflater == null) { throw new NullLayoutInflaterException( "RendererBuilder needs a LayoutInflater to create a RendererViewHolder"); } if (parent == null) { throw new NullParentException( "RendererBuilder needs a parent to create a RendererViewHolder"); } }
[ "private", "void", "validateAttributesToCreateANewRendererViewHolder", "(", ")", "{", "if", "(", "viewType", "==", "null", ")", "{", "throw", "new", "NullContentException", "(", "\"RendererBuilder needs a view type to create a RendererViewHolder\"", ")", ";", "}", "if", "...
Throws one RendererException if the viewType, layoutInflater or parent are null.
[ "Throws", "one", "RendererException", "if", "the", "viewType", "layoutInflater", "or", "parent", "are", "null", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L401-L414
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java
RendererBuilder.getPrototypeClass
protected Class getPrototypeClass(T content) { if (prototypes.size() == 1) { return prototypes.get(0).getClass(); } else { return binding.get(content.getClass()); } }
java
protected Class getPrototypeClass(T content) { if (prototypes.size() == 1) { return prototypes.get(0).getClass(); } else { return binding.get(content.getClass()); } }
[ "protected", "Class", "getPrototypeClass", "(", "T", "content", ")", "{", "if", "(", "prototypes", ".", "size", "(", ")", "==", "1", ")", "{", "return", "prototypes", ".", "get", "(", "0", ")", ".", "getClass", "(", ")", ";", "}", "else", "{", "ret...
Method to be implemented by the RendererBuilder subtypes. In this method the library user will define the mapping between content and renderer class. @param content used to map object to Renderers. @return the class associated to the renderer.
[ "Method", "to", "be", "implemented", "by", "the", "RendererBuilder", "subtypes", ".", "In", "this", "method", "the", "library", "user", "will", "define", "the", "mapping", "between", "content", "and", "renderer", "class", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L423-L429
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java
VideoRenderer.inflate
@Override protected View inflate(LayoutInflater inflater, ViewGroup parent) { View inflatedView = inflater.inflate(R.layout.video_renderer, parent, false); /* * You don't have to use ButterKnife library to implement the mapping between your layout * and your widgets you can implement setUpView and hookListener methods declared in * Renderer<T> class. */ ButterKnife.bind(this, inflatedView); return inflatedView; }
java
@Override protected View inflate(LayoutInflater inflater, ViewGroup parent) { View inflatedView = inflater.inflate(R.layout.video_renderer, parent, false); /* * You don't have to use ButterKnife library to implement the mapping between your layout * and your widgets you can implement setUpView and hookListener methods declared in * Renderer<T> class. */ ButterKnife.bind(this, inflatedView); return inflatedView; }
[ "@", "Override", "protected", "View", "inflate", "(", "LayoutInflater", "inflater", ",", "ViewGroup", "parent", ")", "{", "View", "inflatedView", "=", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "video_renderer", ",", "parent", ",", "false", ")...
Inflate the main layout used to render videos in the list view. @param inflater LayoutInflater service to inflate. @param parent ViewGroup used to inflate xml. @return view inflated.
[ "Inflate", "the", "main", "layout", "used", "to", "render", "videos", "in", "the", "list", "view", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java#L52-L61
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java
VideoRenderer.render
@Override public void render() { Video video = getContent(); renderThumbnail(video); renderTitle(video); renderMarker(video); renderLabel(); }
java
@Override public void render() { Video video = getContent(); renderThumbnail(video); renderTitle(video); renderMarker(video); renderLabel(); }
[ "@", "Override", "public", "void", "render", "(", ")", "{", "Video", "video", "=", "getContent", "(", ")", ";", "renderThumbnail", "(", "video", ")", ";", "renderTitle", "(", "video", ")", ";", "renderMarker", "(", "video", ")", ";", "renderLabel", "(", ...
Main render algorithm based on render the video thumbnail, render the title, render the marker and the label.
[ "Main", "render", "algorithm", "based", "on", "render", "the", "video", "thumbnail", "render", "the", "title", "render", "the", "marker", "and", "the", "label", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java#L73-L79
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java
VideoRenderer.renderThumbnail
private void renderThumbnail(Video video) { Picasso.with(getContext()).cancelRequest(thumbnail); Picasso.with(getContext()) .load(video.getThumbnail()) .placeholder(R.drawable.placeholder) .into(thumbnail); }
java
private void renderThumbnail(Video video) { Picasso.with(getContext()).cancelRequest(thumbnail); Picasso.with(getContext()) .load(video.getThumbnail()) .placeholder(R.drawable.placeholder) .into(thumbnail); }
[ "private", "void", "renderThumbnail", "(", "Video", "video", ")", "{", "Picasso", ".", "with", "(", "getContext", "(", ")", ")", ".", "cancelRequest", "(", "thumbnail", ")", ";", "Picasso", ".", "with", "(", "getContext", "(", ")", ")", ".", "load", "(...
Use picasso to render the video thumbnail into the thumbnail widget using a temporal placeholder. @param video to get the rendered thumbnail.
[ "Use", "picasso", "to", "render", "the", "video", "thumbnail", "into", "the", "thumbnail", "widget", "using", "a", "temporal", "placeholder", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/ui/renderers/VideoRenderer.java#L87-L93
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/Renderer.java
Renderer.onCreate
public void onCreate(T content, LayoutInflater layoutInflater, ViewGroup parent) { this.content = content; this.rootView = inflate(layoutInflater, parent); if (rootView == null) { throw new NotInflateViewException( "Renderer instances have to return a not null view in inflateView method"); } this.rootView.setTag(this); setUpView(rootView); hookListeners(rootView); }
java
public void onCreate(T content, LayoutInflater layoutInflater, ViewGroup parent) { this.content = content; this.rootView = inflate(layoutInflater, parent); if (rootView == null) { throw new NotInflateViewException( "Renderer instances have to return a not null view in inflateView method"); } this.rootView.setTag(this); setUpView(rootView); hookListeners(rootView); }
[ "public", "void", "onCreate", "(", "T", "content", ",", "LayoutInflater", "layoutInflater", ",", "ViewGroup", "parent", ")", "{", "this", ".", "content", "=", "content", ";", "this", ".", "rootView", "=", "inflate", "(", "layoutInflater", ",", "parent", ")",...
Method called when the renderer is going to be created. This method has the responsibility of inflate the xml layout using the layoutInflater and the parent ViewGroup, set itself to the tag and call setUpView and hookListeners methods. @param content to render. If you are using Renderers with RecyclerView widget the content will be null in this method. @param layoutInflater used to inflate the view. @param parent used to inflate the view.
[ "Method", "called", "when", "the", "renderer", "is", "going", "to", "be", "created", ".", "This", "method", "has", "the", "responsibility", "of", "inflate", "the", "xml", "layout", "using", "the", "layoutInflater", "and", "the", "parent", "ViewGroup", "set", ...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/Renderer.java#L54-L64
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/Renderer.java
Renderer.copy
Renderer copy() { Renderer copy = null; try { copy = (Renderer) this.clone(); } catch (CloneNotSupportedException e) { Log.e("Renderer", "All your renderers should be clonables."); } return copy; }
java
Renderer copy() { Renderer copy = null; try { copy = (Renderer) this.clone(); } catch (CloneNotSupportedException e) { Log.e("Renderer", "All your renderers should be clonables."); } return copy; }
[ "Renderer", "copy", "(", ")", "{", "Renderer", "copy", "=", "null", ";", "try", "{", "copy", "=", "(", "Renderer", ")", "this", ".", "clone", "(", ")", ";", "}", "catch", "(", "CloneNotSupportedException", "e", ")", "{", "Log", ".", "e", "(", "\"Re...
Create a clone of the Renderer. This method is the base of the prototype mechanism implemented to avoid create new objects from RendererBuilder. Pay an special attention implementing clone method in Renderer subtypes. @return a copy of the current renderer.
[ "Create", "a", "clone", "of", "the", "Renderer", ".", "This", "method", "is", "the", "base", "of", "the", "prototype", "mechanism", "implemented", "to", "avoid", "create", "new", "objects", "from", "RendererBuilder", ".", "Pay", "an", "special", "attention", ...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/Renderer.java#L147-L155
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RendererAdapter.java
RendererAdapter.getView
@Override public View getView(int position, View convertView, ViewGroup parent) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withConvertView(convertView); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); return renderer.getRootView(); }
java
@Override public View getView(int position, View convertView, ViewGroup parent) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withConvertView(convertView); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); return renderer.getRootView(); }
[ "@", "Override", "public", "View", "getView", "(", "int", "position", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "T", "content", "=", "getItem", "(", "position", ")", ";", "rendererBuilder", ".", "withContent", "(", "content", ")", "...
Main method of RendererAdapter. This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer. Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ListView. If rRendererBuilder returns a null Renderer this method will throw a NullRendererBuiltException. @param position to render. @param convertView to use to recycle. @param parent used to inflate views. @return view rendered.
[ "Main", "method", "of", "RendererAdapter", ".", "This", "method", "has", "the", "responsibility", "of", "update", "the", "RendererBuilder", "values", "and", "create", "or", "recycle", "a", "new", "Renderer", ".", "Once", "the", "renderer", "has", "been", "obta...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererAdapter.java#L86-L99
train
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/VPRendererAdapter.java
VPRendererAdapter.instantiateItem
@Override public Object instantiateItem(ViewGroup parent, int position) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); View view = renderer.getRootView(); parent.addView(view); return view; }
java
@Override public Object instantiateItem(ViewGroup parent, int position) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); View view = renderer.getRootView(); parent.addView(view); return view; }
[ "@", "Override", "public", "Object", "instantiateItem", "(", "ViewGroup", "parent", ",", "int", "position", ")", "{", "T", "content", "=", "getItem", "(", "position", ")", ";", "rendererBuilder", ".", "withContent", "(", "content", ")", ";", "rendererBuilder",...
Main method of VPRendererAdapter. This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer. Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ViewPager. If RendererBuilder returns a null Renderer this method will throw a NullRendererBuiltException. @param parent The containing View in which the page will be shown. @param position to render. @return view rendered.
[ "Main", "method", "of", "VPRendererAdapter", ".", "This", "method", "has", "the", "responsibility", "of", "update", "the", "RendererBuilder", "values", "and", "create", "or", "recycle", "a", "new", "Renderer", ".", "Once", "the", "renderer", "has", "been", "ob...
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/VPRendererAdapter.java#L66-L80
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java
RandomVideoCollectionGenerator.generate
public VideoCollection generate(final int videoCount) { List<Video> videos = new LinkedList<Video>(); for (int i = 0; i < videoCount; i++) { Video video = generateRandomVideo(); videos.add(video); } return new VideoCollection(videos); }
java
public VideoCollection generate(final int videoCount) { List<Video> videos = new LinkedList<Video>(); for (int i = 0; i < videoCount; i++) { Video video = generateRandomVideo(); videos.add(video); } return new VideoCollection(videos); }
[ "public", "VideoCollection", "generate", "(", "final", "int", "videoCount", ")", "{", "List", "<", "Video", ">", "videos", "=", "new", "LinkedList", "<", "Video", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "videoCount", ";",...
Generate a VideoCollection with random data obtained form VIDEO_INFO map. You don't need o create your own AdapteeCollections. Review ListAdapteeCollection if needed. @param videoCount size of the collection. @return VideoCollection generated.
[ "Generate", "a", "VideoCollection", "with", "random", "data", "obtained", "form", "VIDEO_INFO", "map", ".", "You", "don", "t", "need", "o", "create", "your", "own", "AdapteeCollections", ".", "Review", "ListAdapteeCollection", "if", "needed", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java#L49-L56
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java
RandomVideoCollectionGenerator.initializeVideoInfo
private void initializeVideoInfo() { VIDEO_INFO.put("The Big Bang Theory", "http://thetvdb.com/banners/_cache/posters/80379-9.jpg"); VIDEO_INFO.put("Breaking Bad", "http://thetvdb.com/banners/_cache/posters/81189-22.jpg"); VIDEO_INFO.put("Arrow", "http://thetvdb.com/banners/_cache/posters/257655-15.jpg"); VIDEO_INFO.put("Game of Thrones", "http://thetvdb.com/banners/_cache/posters/121361-26.jpg"); VIDEO_INFO.put("Lost", "http://thetvdb.com/banners/_cache/posters/73739-2.jpg"); VIDEO_INFO.put("How I met your mother", "http://thetvdb.com/banners/_cache/posters/75760-29.jpg"); VIDEO_INFO.put("Dexter", "http://thetvdb.com/banners/_cache/posters/79349-24.jpg"); VIDEO_INFO.put("Sleepy Hollow", "http://thetvdb.com/banners/_cache/posters/269578-5.jpg"); VIDEO_INFO.put("The Vampire Diaries", "http://thetvdb.com/banners/_cache/posters/95491-27.jpg"); VIDEO_INFO.put("Friends", "http://thetvdb.com/banners/_cache/posters/79168-4.jpg"); VIDEO_INFO.put("New Girl", "http://thetvdb.com/banners/_cache/posters/248682-9.jpg"); VIDEO_INFO.put("The Mentalist", "http://thetvdb.com/banners/_cache/posters/82459-1.jpg"); VIDEO_INFO.put("Sons of Anarchy", "http://thetvdb.com/banners/_cache/posters/82696-1.jpg"); }
java
private void initializeVideoInfo() { VIDEO_INFO.put("The Big Bang Theory", "http://thetvdb.com/banners/_cache/posters/80379-9.jpg"); VIDEO_INFO.put("Breaking Bad", "http://thetvdb.com/banners/_cache/posters/81189-22.jpg"); VIDEO_INFO.put("Arrow", "http://thetvdb.com/banners/_cache/posters/257655-15.jpg"); VIDEO_INFO.put("Game of Thrones", "http://thetvdb.com/banners/_cache/posters/121361-26.jpg"); VIDEO_INFO.put("Lost", "http://thetvdb.com/banners/_cache/posters/73739-2.jpg"); VIDEO_INFO.put("How I met your mother", "http://thetvdb.com/banners/_cache/posters/75760-29.jpg"); VIDEO_INFO.put("Dexter", "http://thetvdb.com/banners/_cache/posters/79349-24.jpg"); VIDEO_INFO.put("Sleepy Hollow", "http://thetvdb.com/banners/_cache/posters/269578-5.jpg"); VIDEO_INFO.put("The Vampire Diaries", "http://thetvdb.com/banners/_cache/posters/95491-27.jpg"); VIDEO_INFO.put("Friends", "http://thetvdb.com/banners/_cache/posters/79168-4.jpg"); VIDEO_INFO.put("New Girl", "http://thetvdb.com/banners/_cache/posters/248682-9.jpg"); VIDEO_INFO.put("The Mentalist", "http://thetvdb.com/banners/_cache/posters/82459-1.jpg"); VIDEO_INFO.put("Sons of Anarchy", "http://thetvdb.com/banners/_cache/posters/82696-1.jpg"); }
[ "private", "void", "initializeVideoInfo", "(", ")", "{", "VIDEO_INFO", ".", "put", "(", "\"The Big Bang Theory\"", ",", "\"http://thetvdb.com/banners/_cache/posters/80379-9.jpg\"", ")", ";", "VIDEO_INFO", ".", "put", "(", "\"Breaking Bad\"", ",", "\"http://thetvdb.com/banne...
Initialize VIDEO_INFO data.
[ "Initialize", "VIDEO_INFO", "data", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java#L70-L85
train
pedrovgs/Renderers
sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java
RandomVideoCollectionGenerator.generateRandomVideo
private Video generateRandomVideo() { Video video = new Video(); configureFavoriteStatus(video); configureLikeStatus(video); configureLiveStatus(video); configureTitleAndThumbnail(video); return video; }
java
private Video generateRandomVideo() { Video video = new Video(); configureFavoriteStatus(video); configureLikeStatus(video); configureLiveStatus(video); configureTitleAndThumbnail(video); return video; }
[ "private", "Video", "generateRandomVideo", "(", ")", "{", "Video", "video", "=", "new", "Video", "(", ")", ";", "configureFavoriteStatus", "(", "video", ")", ";", "configureLikeStatus", "(", "video", ")", ";", "configureLiveStatus", "(", "video", ")", ";", "...
Create a random video. @return random video.
[ "Create", "a", "random", "video", "." ]
7477fb6e3984468b32b59c8520b66afb765081ea
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/sample/src/main/java/com/pedrogomez/renderers/sample/model/RandomVideoCollectionGenerator.java#L92-L99
train
http4s/blaze
http/src/main/java/org/http4s/blaze/http/parser/BodyAndHeaderParser.java
BodyAndHeaderParser.parseContent
protected final ByteBuffer parseContent(ByteBuffer in) throws BaseExceptions.ParserException { if (contentComplete()) { throw new BaseExceptions.InvalidState("content already complete: " + _endOfContent); } else { switch (_endOfContent) { case UNKNOWN_CONTENT: // This makes sense only for response parsing. Requests must always have // either Content-Length or Transfer-Encoding _endOfContent = EndOfContent.EOF_CONTENT; _contentLength = Long.MAX_VALUE; // Its up to the user to limit a body size return parseContent(in); case CONTENT_LENGTH: case EOF_CONTENT: return nonChunkedContent(in); case CHUNKED_CONTENT: return chunkedContent(in); default: throw new BaseExceptions.InvalidState("not implemented: " + _endOfContent); } } }
java
protected final ByteBuffer parseContent(ByteBuffer in) throws BaseExceptions.ParserException { if (contentComplete()) { throw new BaseExceptions.InvalidState("content already complete: " + _endOfContent); } else { switch (_endOfContent) { case UNKNOWN_CONTENT: // This makes sense only for response parsing. Requests must always have // either Content-Length or Transfer-Encoding _endOfContent = EndOfContent.EOF_CONTENT; _contentLength = Long.MAX_VALUE; // Its up to the user to limit a body size return parseContent(in); case CONTENT_LENGTH: case EOF_CONTENT: return nonChunkedContent(in); case CHUNKED_CONTENT: return chunkedContent(in); default: throw new BaseExceptions.InvalidState("not implemented: " + _endOfContent); } } }
[ "protected", "final", "ByteBuffer", "parseContent", "(", "ByteBuffer", "in", ")", "throws", "BaseExceptions", ".", "ParserException", "{", "if", "(", "contentComplete", "(", ")", ")", "{", "throw", "new", "BaseExceptions", ".", "InvalidState", "(", "\"content alre...
Parses the buffer into body content @param in ByteBuffer to parse @return a ByteBuffer with the parsed body content. Buffer in may not be depleted. If more data is needed, null is returned. In the case of content complete, an empty ByteBuffer is returned. @throws BaseExceptions.ParserException
[ "Parses", "the", "buffer", "into", "body", "content" ]
699e6b478d66e5e1b426cf71c5bd47987d884b8a
https://github.com/http4s/blaze/blob/699e6b478d66e5e1b426cf71c5bd47987d884b8a/http/src/main/java/org/http4s/blaze/http/parser/BodyAndHeaderParser.java#L286-L310
train
http4s/blaze
http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java
ParserBase.putChar
final protected void putChar(char c) { final int clen = _internalBuffer.length; if (clen == _bufferPosition) { final char[] next = new char[2 * clen + 1]; System.arraycopy(_internalBuffer, 0, next, 0, _bufferPosition); _internalBuffer = next; } _internalBuffer[_bufferPosition++] = c; }
java
final protected void putChar(char c) { final int clen = _internalBuffer.length; if (clen == _bufferPosition) { final char[] next = new char[2 * clen + 1]; System.arraycopy(_internalBuffer, 0, next, 0, _bufferPosition); _internalBuffer = next; } _internalBuffer[_bufferPosition++] = c; }
[ "final", "protected", "void", "putChar", "(", "char", "c", ")", "{", "final", "int", "clen", "=", "_internalBuffer", ".", "length", ";", "if", "(", "clen", "==", "_bufferPosition", ")", "{", "final", "char", "[", "]", "next", "=", "new", "char", "[", ...
Store the char in the internal buffer
[ "Store", "the", "char", "in", "the", "internal", "buffer" ]
699e6b478d66e5e1b426cf71c5bd47987d884b8a
https://github.com/http4s/blaze/blob/699e6b478d66e5e1b426cf71c5bd47987d884b8a/http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java#L40-L50
train
http4s/blaze
http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java
ParserBase.getTrimmedString
final protected String getTrimmedString() throws BadMessage { if (_bufferPosition == 0) return ""; int start = 0; boolean quoted = false; // Look for start while (start < _bufferPosition) { final char ch = _internalBuffer[start]; if (ch == '"') { quoted = true; break; } else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) { break; } start++; } int end = _bufferPosition; // Position is of next write // Look for end while(end > start) { final char ch = _internalBuffer[end - 1]; if (quoted) { if (ch == '"') break; else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) { throw new BadMessage("String might not quoted correctly: '" + getString() + "'"); } } else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) break; end--; } String str = new String(_internalBuffer, start, end - start); return str; }
java
final protected String getTrimmedString() throws BadMessage { if (_bufferPosition == 0) return ""; int start = 0; boolean quoted = false; // Look for start while (start < _bufferPosition) { final char ch = _internalBuffer[start]; if (ch == '"') { quoted = true; break; } else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) { break; } start++; } int end = _bufferPosition; // Position is of next write // Look for end while(end > start) { final char ch = _internalBuffer[end - 1]; if (quoted) { if (ch == '"') break; else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) { throw new BadMessage("String might not quoted correctly: '" + getString() + "'"); } } else if (ch != HttpTokens.SPACE && ch != HttpTokens.TAB) break; end--; } String str = new String(_internalBuffer, start, end - start); return str; }
[ "final", "protected", "String", "getTrimmedString", "(", ")", "throws", "BadMessage", "{", "if", "(", "_bufferPosition", "==", "0", ")", "return", "\"\"", ";", "int", "start", "=", "0", ";", "boolean", "quoted", "=", "false", ";", "// Look for start", "while...
Returns the string in the buffer minus an leading or trailing whitespace or quotes
[ "Returns", "the", "string", "in", "the", "buffer", "minus", "an", "leading", "or", "trailing", "whitespace", "or", "quotes" ]
699e6b478d66e5e1b426cf71c5bd47987d884b8a
https://github.com/http4s/blaze/blob/699e6b478d66e5e1b426cf71c5bd47987d884b8a/http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java#L82-L119
train
http4s/blaze
http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java
ParserBase.next
final protected char next(final ByteBuffer buffer, boolean allow8859) throws BaseExceptions.BadMessage { if (!buffer.hasRemaining()) return HttpTokens.EMPTY_BUFF; if (_segmentByteLimit <= _segmentBytePosition) { shutdownParser(); throw new BaseExceptions.BadMessage("Request length limit exceeded: " + _segmentByteLimit); } final byte b = buffer.get(); _segmentBytePosition++; // If we ended on a CR, make sure we are if (_cr) { if (b != HttpTokens.LF) { throw new BadCharacter("Invalid sequence: LF didn't follow CR: " + b); } _cr = false; return (char)b; // must be LF } // Make sure its a valid character if (b < HttpTokens.SPACE) { if (b == HttpTokens.CR) { // Set the flag to check for _cr and just run again _cr = true; return next(buffer, allow8859); } else if (b == HttpTokens.TAB || allow8859 && b < 0) { return (char)(b & 0xff); } else if (b == HttpTokens.LF) { return (char)b; // A backend should accept a bare linefeed. http://tools.ietf.org/html/rfc2616#section-19.3 } else if (isLenient()) { return HttpTokens.REPLACEMENT; } else { shutdownParser(); throw new BadCharacter("Invalid char: '" + (char)(b & 0xff) + "', 0x" + Integer.toHexString(b)); } } // valid ascii char return (char)b; }
java
final protected char next(final ByteBuffer buffer, boolean allow8859) throws BaseExceptions.BadMessage { if (!buffer.hasRemaining()) return HttpTokens.EMPTY_BUFF; if (_segmentByteLimit <= _segmentBytePosition) { shutdownParser(); throw new BaseExceptions.BadMessage("Request length limit exceeded: " + _segmentByteLimit); } final byte b = buffer.get(); _segmentBytePosition++; // If we ended on a CR, make sure we are if (_cr) { if (b != HttpTokens.LF) { throw new BadCharacter("Invalid sequence: LF didn't follow CR: " + b); } _cr = false; return (char)b; // must be LF } // Make sure its a valid character if (b < HttpTokens.SPACE) { if (b == HttpTokens.CR) { // Set the flag to check for _cr and just run again _cr = true; return next(buffer, allow8859); } else if (b == HttpTokens.TAB || allow8859 && b < 0) { return (char)(b & 0xff); } else if (b == HttpTokens.LF) { return (char)b; // A backend should accept a bare linefeed. http://tools.ietf.org/html/rfc2616#section-19.3 } else if (isLenient()) { return HttpTokens.REPLACEMENT; } else { shutdownParser(); throw new BadCharacter("Invalid char: '" + (char)(b & 0xff) + "', 0x" + Integer.toHexString(b)); } } // valid ascii char return (char)b; }
[ "final", "protected", "char", "next", "(", "final", "ByteBuffer", "buffer", ",", "boolean", "allow8859", ")", "throws", "BaseExceptions", ".", "BadMessage", "{", "if", "(", "!", "buffer", ".", "hasRemaining", "(", ")", ")", "return", "HttpTokens", ".", "EMPT...
Removes CRs but returns LFs
[ "Removes", "CRs", "but", "returns", "LFs" ]
699e6b478d66e5e1b426cf71c5bd47987d884b8a
https://github.com/http4s/blaze/blob/699e6b478d66e5e1b426cf71c5bd47987d884b8a/http/src/main/java/org/http4s/blaze/http/parser/ParserBase.java#L140-L184
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView.java
GanttChartView.mapGanttBarHeight
protected int mapGanttBarHeight(int height) { switch (height) { case 0: { height = 6; break; } case 1: { height = 8; break; } case 2: { height = 10; break; } case 3: { height = 12; break; } case 4: { height = 14; break; } case 5: { height = 18; break; } case 6: { height = 24; break; } } return (height); }
java
protected int mapGanttBarHeight(int height) { switch (height) { case 0: { height = 6; break; } case 1: { height = 8; break; } case 2: { height = 10; break; } case 3: { height = 12; break; } case 4: { height = 14; break; } case 5: { height = 18; break; } case 6: { height = 24; break; } } return (height); }
[ "protected", "int", "mapGanttBarHeight", "(", "int", "height", ")", "{", "switch", "(", "height", ")", "{", "case", "0", ":", "{", "height", "=", "6", ";", "break", ";", "}", "case", "1", ":", "{", "height", "=", "8", ";", "break", ";", "}", "cas...
This method maps the encoded height of a Gantt bar to the height in pixels. @param height encoded height @return height in pixels
[ "This", "method", "maps", "the", "encoded", "height", "of", "a", "Gantt", "bar", "to", "the", "height", "in", "pixels", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView.java#L1077-L1125
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView.java
GanttChartView.getColumnFontStyle
protected TableFontStyle getColumnFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases) { int uniqueID = MPPUtility.getInt(data, offset); FieldType fieldType = MPPTaskField.getInstance(MPPUtility.getShort(data, offset + 4)); Integer index = Integer.valueOf(MPPUtility.getByte(data, offset + 8)); int style = MPPUtility.getByte(data, offset + 9); ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 10)); int change = MPPUtility.getByte(data, offset + 12); FontBase fontBase = fontBases.get(index); boolean bold = ((style & 0x01) != 0); boolean italic = ((style & 0x02) != 0); boolean underline = ((style & 0x04) != 0); boolean boldChanged = ((change & 0x01) != 0); boolean underlineChanged = ((change & 0x02) != 0); boolean italicChanged = ((change & 0x04) != 0); boolean colorChanged = ((change & 0x08) != 0); boolean fontChanged = ((change & 0x10) != 0); boolean backgroundColorChanged = (uniqueID == -1); boolean backgroundPatternChanged = (uniqueID == -1); return (new TableFontStyle(uniqueID, fieldType, fontBase, italic, bold, underline, false, color.getColor(), Color.BLACK, BackgroundPattern.TRANSPARENT, italicChanged, boldChanged, underlineChanged, false, colorChanged, fontChanged, backgroundColorChanged, backgroundPatternChanged)); }
java
protected TableFontStyle getColumnFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases) { int uniqueID = MPPUtility.getInt(data, offset); FieldType fieldType = MPPTaskField.getInstance(MPPUtility.getShort(data, offset + 4)); Integer index = Integer.valueOf(MPPUtility.getByte(data, offset + 8)); int style = MPPUtility.getByte(data, offset + 9); ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 10)); int change = MPPUtility.getByte(data, offset + 12); FontBase fontBase = fontBases.get(index); boolean bold = ((style & 0x01) != 0); boolean italic = ((style & 0x02) != 0); boolean underline = ((style & 0x04) != 0); boolean boldChanged = ((change & 0x01) != 0); boolean underlineChanged = ((change & 0x02) != 0); boolean italicChanged = ((change & 0x04) != 0); boolean colorChanged = ((change & 0x08) != 0); boolean fontChanged = ((change & 0x10) != 0); boolean backgroundColorChanged = (uniqueID == -1); boolean backgroundPatternChanged = (uniqueID == -1); return (new TableFontStyle(uniqueID, fieldType, fontBase, italic, bold, underline, false, color.getColor(), Color.BLACK, BackgroundPattern.TRANSPARENT, italicChanged, boldChanged, underlineChanged, false, colorChanged, fontChanged, backgroundColorChanged, backgroundPatternChanged)); }
[ "protected", "TableFontStyle", "getColumnFontStyle", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "Map", "<", "Integer", ",", "FontBase", ">", "fontBases", ")", "{", "int", "uniqueID", "=", "MPPUtility", ".", "getInt", "(", "data", ",", "offse...
Retrieve column font details from a block of property data. @param data property data @param offset offset into property data @param fontBases map of font bases @return ColumnFontStyle instance
[ "Retrieve", "column", "font", "details", "from", "a", "block", "of", "property", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView.java#L1159-L1183
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java
PhoenixInputStream.prepareInputStream
private InputStream prepareInputStream(InputStream stream) throws IOException { InputStream result; BufferedInputStream bis = new BufferedInputStream(stream); readHeaderProperties(bis); if (isCompressed()) { result = new InflaterInputStream(bis); } else { result = bis; } return result; }
java
private InputStream prepareInputStream(InputStream stream) throws IOException { InputStream result; BufferedInputStream bis = new BufferedInputStream(stream); readHeaderProperties(bis); if (isCompressed()) { result = new InflaterInputStream(bis); } else { result = bis; } return result; }
[ "private", "InputStream", "prepareInputStream", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "InputStream", "result", ";", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "stream", ")", ";", "readHeaderProperties", "(", "bis",...
If the file is compressed, handle this so that the stream is ready to read. @param stream input stream @return uncompressed input stream
[ "If", "the", "file", "is", "compressed", "handle", "this", "so", "that", "the", "stream", "is", "ready", "to", "read", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java#L88-L102
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java
PhoenixInputStream.readHeaderString
private String readHeaderString(BufferedInputStream stream) throws IOException { int bufferSize = 100; stream.mark(bufferSize); byte[] buffer = new byte[bufferSize]; stream.read(buffer); Charset charset = CharsetHelper.UTF8; String header = new String(buffer, charset); int prefixIndex = header.indexOf("PPX!!!!|"); int suffixIndex = header.indexOf("|!!!!XPP"); if (prefixIndex != 0 || suffixIndex == -1) { throw new IOException("File format not recognised"); } int skip = suffixIndex + 9; stream.reset(); stream.skip(skip); return header.substring(prefixIndex + 8, suffixIndex); }
java
private String readHeaderString(BufferedInputStream stream) throws IOException { int bufferSize = 100; stream.mark(bufferSize); byte[] buffer = new byte[bufferSize]; stream.read(buffer); Charset charset = CharsetHelper.UTF8; String header = new String(buffer, charset); int prefixIndex = header.indexOf("PPX!!!!|"); int suffixIndex = header.indexOf("|!!!!XPP"); if (prefixIndex != 0 || suffixIndex == -1) { throw new IOException("File format not recognised"); } int skip = suffixIndex + 9; stream.reset(); stream.skip(skip); return header.substring(prefixIndex + 8, suffixIndex); }
[ "private", "String", "readHeaderString", "(", "BufferedInputStream", "stream", ")", "throws", "IOException", "{", "int", "bufferSize", "=", "100", ";", "stream", ".", "mark", "(", "bufferSize", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", ...
Read the header from the Phoenix file. @param stream input stream @return raw header data
[ "Read", "the", "header", "from", "the", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java#L110-L131
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java
PhoenixInputStream.readHeaderProperties
private void readHeaderProperties(BufferedInputStream stream) throws IOException { String header = readHeaderString(stream); for (String property : header.split("\\|")) { String[] expression = property.split("="); m_properties.put(expression[0], expression[1]); } }
java
private void readHeaderProperties(BufferedInputStream stream) throws IOException { String header = readHeaderString(stream); for (String property : header.split("\\|")) { String[] expression = property.split("="); m_properties.put(expression[0], expression[1]); } }
[ "private", "void", "readHeaderProperties", "(", "BufferedInputStream", "stream", ")", "throws", "IOException", "{", "String", "header", "=", "readHeaderString", "(", "stream", ")", ";", "for", "(", "String", "property", ":", "header", ".", "split", "(", "\"\\\\|...
Read properties from the raw header data. @param stream input stream
[ "Read", "properties", "from", "the", "raw", "header", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixInputStream.java#L138-L146
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.process
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { try { populateMemberData(reader, file, root); processProjectProperties(); if (!reader.getReadPropertiesOnly()) { processCalendarData(); processResourceData(); processTaskData(); processConstraintData(); processAssignmentData(); if (reader.getReadPresentationData()) { processViewPropertyData(); processViewData(); processTableData(); } } } finally { clearMemberData(); } }
java
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { try { populateMemberData(reader, file, root); processProjectProperties(); if (!reader.getReadPropertiesOnly()) { processCalendarData(); processResourceData(); processTaskData(); processConstraintData(); processAssignmentData(); if (reader.getReadPresentationData()) { processViewPropertyData(); processViewData(); processTableData(); } } } finally { clearMemberData(); } }
[ "@", "Override", "public", "void", "process", "(", "MPPReader", "reader", ",", "ProjectFile", "file", ",", "DirectoryEntry", "root", ")", "throws", "MPXJException", ",", "IOException", "{", "try", "{", "populateMemberData", "(", "reader", ",", "file", ",", "ro...
This method is used to process an MPP8 file. This is the file format used by Project 98. @param reader parent file reader @param file Parent MPX file @param root Root of the POI file system. @throws MPXJException @throws IOException
[ "This", "method", "is", "used", "to", "process", "an", "MPP8", "file", ".", "This", "is", "the", "file", "format", "used", "by", "Project", "98", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L88-L116
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.updateBaseCalendarNames
private void updateBaseCalendarNames(List<Pair<ProjectCalendar, Integer>> baseCalendars) { for (Pair<ProjectCalendar, Integer> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); Integer baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = m_calendarMap.get(baseCalendarID); if (baseCal != null) { cal.setParent(baseCal); } } }
java
private void updateBaseCalendarNames(List<Pair<ProjectCalendar, Integer>> baseCalendars) { for (Pair<ProjectCalendar, Integer> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); Integer baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = m_calendarMap.get(baseCalendarID); if (baseCal != null) { cal.setParent(baseCal); } } }
[ "private", "void", "updateBaseCalendarNames", "(", "List", "<", "Pair", "<", "ProjectCalendar", ",", "Integer", ">", ">", "baseCalendars", ")", "{", "for", "(", "Pair", "<", "ProjectCalendar", ",", "Integer", ">", "pair", ":", "baseCalendars", ")", "{", "Pro...
The way calendars are stored in an MPP8 file means that there can be forward references between the base calendar unique ID for a derived calendar, and the base calendar itself. To get around this, we initially populate the base calendar name attribute with the base calendar unique ID, and now in this method we can convert those ID values into the correct names. @param baseCalendars list of calendars and base calendar IDs
[ "The", "way", "calendars", "are", "stored", "in", "an", "MPP8", "file", "means", "that", "there", "can", "be", "forward", "references", "between", "the", "base", "calendar", "unique", "ID", "for", "a", "derived", "calendar", "and", "the", "base", "calendar",...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L374-L386
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.setTaskNotes
private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData) { String notes = taskExtData.getString(TASK_NOTES); if (notes == null && data.length == 366) { byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362)); if (offsetData != null && offsetData.length >= 12) { notes = taskVarData.getString(getOffset(offsetData, 8)); // We do pick up some random stuff with this approach, and // we don't know enough about the file format to know when to ignore it // so we'll use a heuristic here to ignore anything that // doesn't look like RTF. if (notes != null && notes.indexOf('{') == -1) { notes = null; } } } if (notes != null) { if (m_reader.getPreserveNoteFormatting() == false) { notes = RtfHelper.strip(notes); } task.setNotes(notes); } }
java
private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData) { String notes = taskExtData.getString(TASK_NOTES); if (notes == null && data.length == 366) { byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362)); if (offsetData != null && offsetData.length >= 12) { notes = taskVarData.getString(getOffset(offsetData, 8)); // We do pick up some random stuff with this approach, and // we don't know enough about the file format to know when to ignore it // so we'll use a heuristic here to ignore anything that // doesn't look like RTF. if (notes != null && notes.indexOf('{') == -1) { notes = null; } } } if (notes != null) { if (m_reader.getPreserveNoteFormatting() == false) { notes = RtfHelper.strip(notes); } task.setNotes(notes); } }
[ "private", "void", "setTaskNotes", "(", "Task", "task", ",", "byte", "[", "]", "data", ",", "ExtendedData", "taskExtData", ",", "FixDeferFix", "taskVarData", ")", "{", "String", "notes", "=", "taskExtData", ".", "getString", "(", "TASK_NOTES", ")", ";", "if"...
There appear to be two ways of representing task notes in an MPP8 file. This method tries to determine which has been used. @param task task @param data task data @param taskExtData extended task data @param taskVarData task var data
[ "There", "appear", "to", "be", "two", "ways", "of", "representing", "task", "notes", "in", "an", "MPP8", "file", ".", "This", "method", "tries", "to", "determine", "which", "has", "been", "used", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L742-L772
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.processHyperlinkData
private void processHyperlinkData(Task task, byte[] data) { if (data != null) { int offset = 12; String hyperlink; String address; String subaddress; offset += 12; hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; subaddress = MPPUtility.getUnicodeString(data, offset); task.setHyperlink(hyperlink); task.setHyperlinkAddress(address); task.setHyperlinkSubAddress(subaddress); } }
java
private void processHyperlinkData(Task task, byte[] data) { if (data != null) { int offset = 12; String hyperlink; String address; String subaddress; offset += 12; hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; subaddress = MPPUtility.getUnicodeString(data, offset); task.setHyperlink(hyperlink); task.setHyperlinkAddress(address); task.setHyperlinkSubAddress(subaddress); } }
[ "private", "void", "processHyperlinkData", "(", "Task", "task", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "int", "offset", "=", "12", ";", "String", "hyperlink", ";", "String", "address", ";", "String", "subadd...
This method is used to extract the task hyperlink attributes from a block of data and call the appropriate modifier methods to configure the specified task object. @param task task instance @param data hyperlink data block
[ "This", "method", "is", "used", "to", "extract", "the", "task", "hyperlink", "attributes", "from", "a", "block", "of", "data", "and", "call", "the", "appropriate", "modifier", "methods", "to", "configure", "the", "specified", "task", "object", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L782-L806
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java
PrimaveraConvert.process
public void process(String driverClass, String connectionString, String projectID, String outputFile) throws Exception { System.out.println("Reading Primavera database started."); Class.forName(driverClass); Properties props = new Properties(); // // This is not a very robust way to detect that we're working with SQLlite... // If you are trying to grab data from // a standalone P6 using SQLite, the SQLite JDBC driver needs this property // in order to correctly parse timestamps. // if (driverClass.equals("org.sqlite.JDBC")) { props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); } Connection c = DriverManager.getConnection(connectionString, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(c); processProject(reader, Integer.parseInt(projectID), outputFile); }
java
public void process(String driverClass, String connectionString, String projectID, String outputFile) throws Exception { System.out.println("Reading Primavera database started."); Class.forName(driverClass); Properties props = new Properties(); // // This is not a very robust way to detect that we're working with SQLlite... // If you are trying to grab data from // a standalone P6 using SQLite, the SQLite JDBC driver needs this property // in order to correctly parse timestamps. // if (driverClass.equals("org.sqlite.JDBC")) { props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); } Connection c = DriverManager.getConnection(connectionString, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(c); processProject(reader, Integer.parseInt(projectID), outputFile); }
[ "public", "void", "process", "(", "String", "driverClass", ",", "String", "connectionString", ",", "String", "projectID", ",", "String", "outputFile", ")", "throws", "Exception", "{", "System", ".", "out", ".", "println", "(", "\"Reading Primavera database started.\...
Extract Primavera project data and export in another format. @param driverClass JDBC driver class name @param connectionString JDBC connection string @param projectID project ID @param outputFile output file @throws Exception
[ "Extract", "Primavera", "project", "data", "and", "export", "in", "another", "format", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java#L82-L105
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java
PrimaveraConvert.processProject
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
java
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
[ "private", "void", "processProject", "(", "PrimaveraDatabaseReader", "reader", ",", "int", "projectID", ",", "String", "outputFile", ")", "throws", "Exception", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "reader", ".", "setProj...
Process a single project. @param reader Primavera reader @param projectID required project ID @param outputFile output file name
[ "Process", "a", "single", "project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java#L114-L128
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/MPPResourceField.java
MPPResourceField.getInstance
public static ResourceField getInstance(int value) { ResourceField result = null; if (value >= 0 && value < FIELD_ARRAY.length) { result = FIELD_ARRAY[value]; } else { if ((value & 0x8000) != 0) { int baseValue = ResourceField.ENTERPRISE_CUSTOM_FIELD1.getValue(); int id = baseValue + (value & 0xFFF); result = ResourceField.getInstance(id); } } return (result); }
java
public static ResourceField getInstance(int value) { ResourceField result = null; if (value >= 0 && value < FIELD_ARRAY.length) { result = FIELD_ARRAY[value]; } else { if ((value & 0x8000) != 0) { int baseValue = ResourceField.ENTERPRISE_CUSTOM_FIELD1.getValue(); int id = baseValue + (value & 0xFFF); result = ResourceField.getInstance(id); } } return (result); }
[ "public", "static", "ResourceField", "getInstance", "(", "int", "value", ")", "{", "ResourceField", "result", "=", "null", ";", "if", "(", "value", ">=", "0", "&&", "value", "<", "FIELD_ARRAY", ".", "length", ")", "{", "result", "=", "FIELD_ARRAY", "[", ...
Retrieve an instance of the ResourceField class based on the data read from an MS Project file. @param value value from an MS Project file @return ResourceField instance
[ "Retrieve", "an", "instance", "of", "the", "ResourceField", "class", "based", "on", "the", "data", "read", "from", "an", "MS", "Project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/MPPResourceField.java#L44-L63
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.update
public void update(Record record, boolean isText) throws MPXJException { int length = record.getLength(); for (int i = 0; i < length; i++) { if (isText == true) { add(getTaskCode(record.getString(i))); } else { add(record.getInteger(i).intValue()); } } }
java
public void update(Record record, boolean isText) throws MPXJException { int length = record.getLength(); for (int i = 0; i < length; i++) { if (isText == true) { add(getTaskCode(record.getString(i))); } else { add(record.getInteger(i).intValue()); } } }
[ "public", "void", "update", "(", "Record", "record", ",", "boolean", "isText", ")", "throws", "MPXJException", "{", "int", "length", "=", "record", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", ...
This method populates the task model from data read from an MPX file. @param record data read from an MPX file @param isText flag indicating whether the textual or numeric data is being supplied
[ "This", "method", "populates", "the", "task", "model", "from", "data", "read", "from", "an", "MPX", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L99-L114
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.add
private void add(int field) { if (field < m_flags.length) { if (m_flags[field] == false) { m_flags[field] = true; m_fields[m_count] = field; ++m_count; } } }
java
private void add(int field) { if (field < m_flags.length) { if (m_flags[field] == false) { m_flags[field] = true; m_fields[m_count] = field; ++m_count; } } }
[ "private", "void", "add", "(", "int", "field", ")", "{", "if", "(", "field", "<", "m_flags", ".", "length", ")", "{", "if", "(", "m_flags", "[", "field", "]", "==", "false", ")", "{", "m_flags", "[", "field", "]", "=", "true", ";", "m_fields", "[...
This method is called from the task class each time an attribute is added, ensuring that all of the attributes present in each task record are present in the resource model. @param field field identifier
[ "This", "method", "is", "called", "from", "the", "task", "class", "each", "time", "an", "attribute", "is", "added", "ensuring", "that", "all", "of", "the", "attributes", "present", "in", "each", "task", "record", "are", "present", "in", "the", "resource", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L123-L134
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.isFieldPopulated
@SuppressWarnings("unchecked") private boolean isFieldPopulated(Task task, TaskField field) { boolean result = false; if (field != null) { Object value = task.getCachedValue(field); switch (field) { case PREDECESSORS: case SUCCESSORS: { result = value != null && !((List<Relation>) value).isEmpty(); break; } default: { result = value != null; break; } } } return result; }
java
@SuppressWarnings("unchecked") private boolean isFieldPopulated(Task task, TaskField field) { boolean result = false; if (field != null) { Object value = task.getCachedValue(field); switch (field) { case PREDECESSORS: case SUCCESSORS: { result = value != null && !((List<Relation>) value).isEmpty(); break; } default: { result = value != null; break; } } } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "isFieldPopulated", "(", "Task", "task", ",", "TaskField", "field", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "field", "!=", "null", ")", "{", "Object", "value", "...
Determine if a task field contains data. @param task task instance @param field target field @return true if the field contains data
[ "Determine", "if", "a", "task", "field", "contains", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L175-L198
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.getTaskField
private String getTaskField(int key) { String result = null; if ((key > 0) && (key < m_taskNames.length)) { result = m_taskNames[key]; } return (result); }
java
private String getTaskField(int key) { String result = null; if ((key > 0) && (key < m_taskNames.length)) { result = m_taskNames[key]; } return (result); }
[ "private", "String", "getTaskField", "(", "int", "key", ")", "{", "String", "result", "=", "null", ";", "if", "(", "(", "key", ">", "0", ")", "&&", "(", "key", "<", "m_taskNames", ".", "length", ")", ")", "{", "result", "=", "m_taskNames", "[", "ke...
Returns Task field name of supplied code no. @param key - the code no of required Task field @return - field name
[ "Returns", "Task", "field", "name", "of", "supplied", "code", "no", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L245-L255
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.getTaskCode
private int getTaskCode(String field) throws MPXJException { Integer result = m_taskNumbers.get(field.trim()); if (result == null) { throw new MPXJException(MPXJException.INVALID_TASK_FIELD_NAME + " " + field); } return (result.intValue()); }
java
private int getTaskCode(String field) throws MPXJException { Integer result = m_taskNumbers.get(field.trim()); if (result == null) { throw new MPXJException(MPXJException.INVALID_TASK_FIELD_NAME + " " + field); } return (result.intValue()); }
[ "private", "int", "getTaskCode", "(", "String", "field", ")", "throws", "MPXJException", "{", "Integer", "result", "=", "m_taskNumbers", ".", "get", "(", "field", ".", "trim", "(", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "n...
Returns code number of Task field supplied. @param field - name @return - code no
[ "Returns", "code", "number", "of", "Task", "field", "supplied", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L263-L273
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/DatatypeConverter.java
DatatypeConverter.parseString
public static String parseString(String value) { if (value != null) { // Strip angle brackets if present if (!value.isEmpty() && value.charAt(0) == '<') { value = value.substring(1, value.length() - 1); } // Strip quotes if present if (!value.isEmpty() && value.charAt(0) == '"') { value = value.substring(1, value.length() - 1); } } return value; }
java
public static String parseString(String value) { if (value != null) { // Strip angle brackets if present if (!value.isEmpty() && value.charAt(0) == '<') { value = value.substring(1, value.length() - 1); } // Strip quotes if present if (!value.isEmpty() && value.charAt(0) == '"') { value = value.substring(1, value.length() - 1); } } return value; }
[ "public", "static", "String", "parseString", "(", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "// Strip angle brackets if present", "if", "(", "!", "value", ".", "isEmpty", "(", ")", "&&", "value", ".", "charAt", "(", "0", ")...
Parse a string. @param value string representation @return String value
[ "Parse", "a", "string", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L46-L63
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/DatatypeConverter.java
DatatypeConverter.parseDouble
public static Number parseDouble(String value) throws ParseException { Number result = null; value = parseString(value); // If we still have a value if (value != null && !value.isEmpty() && !value.equals("-1 -1")) { int index = value.indexOf("E+"); if (index != -1) { value = value.substring(0, index) + 'E' + value.substring(index + 2, value.length()); } if (value.indexOf('E') != -1) { result = DOUBLE_FORMAT.get().parse(value); } else { result = Double.valueOf(value); } } return result; }
java
public static Number parseDouble(String value) throws ParseException { Number result = null; value = parseString(value); // If we still have a value if (value != null && !value.isEmpty() && !value.equals("-1 -1")) { int index = value.indexOf("E+"); if (index != -1) { value = value.substring(0, index) + 'E' + value.substring(index + 2, value.length()); } if (value.indexOf('E') != -1) { result = DOUBLE_FORMAT.get().parse(value); } else { result = Double.valueOf(value); } } return result; }
[ "public", "static", "Number", "parseDouble", "(", "String", "value", ")", "throws", "ParseException", "{", "Number", "result", "=", "null", ";", "value", "=", "parseString", "(", "value", ")", ";", "// If we still have a value", "if", "(", "value", "!=", "null...
Parse the string representation of a double. @param value string representation @return Java representation @throws ParseException
[ "Parse", "the", "string", "representation", "of", "a", "double", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L72-L98
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/DatatypeConverter.java
DatatypeConverter.parseBoolean
public static Boolean parseBoolean(String value) throws ParseException { Boolean result = null; Integer number = parseInteger(value); if (number != null) { result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; } return result; }
java
public static Boolean parseBoolean(String value) throws ParseException { Boolean result = null; Integer number = parseInteger(value); if (number != null) { result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; } return result; }
[ "public", "static", "Boolean", "parseBoolean", "(", "String", "value", ")", "throws", "ParseException", "{", "Boolean", "result", "=", "null", ";", "Integer", "number", "=", "parseInteger", "(", "value", ")", ";", "if", "(", "number", "!=", "null", ")", "{...
Parse a string representation of a Boolean value. @param value string representation @return Boolean value
[ "Parse", "a", "string", "representation", "of", "a", "Boolean", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L106-L116
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/DatatypeConverter.java
DatatypeConverter.parseInteger
public static Integer parseInteger(String value) throws ParseException { Integer result = null; if (value.length() > 0 && value.indexOf(' ') == -1) { if (value.indexOf('.') == -1) { result = Integer.valueOf(value); } else { Number n = DatatypeConverter.parseDouble(value); result = Integer.valueOf(n.intValue()); } } return result; }
java
public static Integer parseInteger(String value) throws ParseException { Integer result = null; if (value.length() > 0 && value.indexOf(' ') == -1) { if (value.indexOf('.') == -1) { result = Integer.valueOf(value); } else { Number n = DatatypeConverter.parseDouble(value); result = Integer.valueOf(n.intValue()); } } return result; }
[ "public", "static", "Integer", "parseInteger", "(", "String", "value", ")", "throws", "ParseException", "{", "Integer", "result", "=", "null", ";", "if", "(", "value", ".", "length", "(", ")", ">", "0", "&&", "value", ".", "indexOf", "(", "'", "'", ")"...
Parse a string representation of an Integer value. @param value string representation @return Integer value
[ "Parse", "a", "string", "representation", "of", "an", "Integer", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L124-L142
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/DatatypeConverter.java
DatatypeConverter.parseEpochTimestamp
public static Date parseEpochTimestamp(String value) { Date result = null; if (value.length() > 0) { if (!value.equals("-1 -1")) { Calendar cal = DateHelper.popCalendar(JAVA_EPOCH); int index = value.indexOf(' '); if (index == -1) { if (value.length() < 6) { value = "000000" + value; value = value.substring(value.length() - 6); } int hours = Integer.parseInt(value.substring(0, 2)); int minutes = Integer.parseInt(value.substring(2, 4)); int seconds = Integer.parseInt(value.substring(4)); cal.set(Calendar.HOUR, hours); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, seconds); } else { long astaDays = Long.parseLong(value.substring(0, index)); int astaSeconds = Integer.parseInt(value.substring(index + 1)); cal.add(Calendar.DAY_OF_YEAR, (int) (astaDays - ASTA_EPOCH)); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.HOUR, 0); cal.add(Calendar.SECOND, astaSeconds); } result = cal.getTime(); DateHelper.pushCalendar(cal); } } return result; }
java
public static Date parseEpochTimestamp(String value) { Date result = null; if (value.length() > 0) { if (!value.equals("-1 -1")) { Calendar cal = DateHelper.popCalendar(JAVA_EPOCH); int index = value.indexOf(' '); if (index == -1) { if (value.length() < 6) { value = "000000" + value; value = value.substring(value.length() - 6); } int hours = Integer.parseInt(value.substring(0, 2)); int minutes = Integer.parseInt(value.substring(2, 4)); int seconds = Integer.parseInt(value.substring(4)); cal.set(Calendar.HOUR, hours); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, seconds); } else { long astaDays = Long.parseLong(value.substring(0, index)); int astaSeconds = Integer.parseInt(value.substring(index + 1)); cal.add(Calendar.DAY_OF_YEAR, (int) (astaDays - ASTA_EPOCH)); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.HOUR, 0); cal.add(Calendar.SECOND, astaSeconds); } result = cal.getTime(); DateHelper.pushCalendar(cal); } } return result; }
[ "public", "static", "Date", "parseEpochTimestamp", "(", "String", "value", ")", "{", "Date", "result", "=", "null", ";", "if", "(", "value", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "!", "value", ".", "equals", "(", "\"-1 -1\"", ")", ...
Parse the string representation of a timestamp. @param value string representation @return Java representation
[ "Parse", "the", "string", "representation", "of", "a", "timestamp", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L150-L195
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processProjectListItem
protected void processProjectListItem(Map<Integer, String> result, Row row) { Integer id = row.getInteger("PROJ_ID"); String name = row.getString("PROJ_NAME"); result.put(id, name); }
java
protected void processProjectListItem(Map<Integer, String> result, Row row) { Integer id = row.getInteger("PROJ_ID"); String name = row.getString("PROJ_NAME"); result.put(id, name); }
[ "protected", "void", "processProjectListItem", "(", "Map", "<", "Integer", ",", "String", ">", "result", ",", "Row", "row", ")", "{", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"PROJ_ID\"", ")", ";", "String", "name", "=", "row", ".", "getStr...
Retrieve the details of a single project from the database. @param result Map instance containing the results @param row result set row read from the database
[ "Retrieve", "the", "details", "of", "a", "single", "project", "from", "the", "database", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L92-L97
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processCalendarData
protected void processCalendarData(ProjectCalendar calendar, Row row) { int dayIndex = row.getInt("CD_DAY_OR_EXCEPTION"); if (dayIndex == 0) { processCalendarException(calendar, row); } else { processCalendarHours(calendar, row, dayIndex); } }
java
protected void processCalendarData(ProjectCalendar calendar, Row row) { int dayIndex = row.getInt("CD_DAY_OR_EXCEPTION"); if (dayIndex == 0) { processCalendarException(calendar, row); } else { processCalendarHours(calendar, row, dayIndex); } }
[ "protected", "void", "processCalendarData", "(", "ProjectCalendar", "calendar", ",", "Row", "row", ")", "{", "int", "dayIndex", "=", "row", ".", "getInt", "(", "\"CD_DAY_OR_EXCEPTION\"", ")", ";", "if", "(", "dayIndex", "==", "0", ")", "{", "processCalendarExc...
Read calendar hours and exception data. @param calendar parent calendar @param row calendar hours and exception data
[ "Read", "calendar", "hours", "and", "exception", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L272-L283
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processCalendarException
private void processCalendarException(ProjectCalendar calendar, Row row) { Date fromDate = row.getDate("CD_FROM_DATE"); Date toDate = row.getDate("CD_TO_DATE"); boolean working = row.getInt("CD_WORKING") != 0; ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (working) { exception.addRange(new DateRange(row.getDate("CD_FROM_TIME1"), row.getDate("CD_TO_TIME1"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME2"), row.getDate("CD_TO_TIME2"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME3"), row.getDate("CD_TO_TIME3"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME4"), row.getDate("CD_TO_TIME4"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME5"), row.getDate("CD_TO_TIME5"))); } }
java
private void processCalendarException(ProjectCalendar calendar, Row row) { Date fromDate = row.getDate("CD_FROM_DATE"); Date toDate = row.getDate("CD_TO_DATE"); boolean working = row.getInt("CD_WORKING") != 0; ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (working) { exception.addRange(new DateRange(row.getDate("CD_FROM_TIME1"), row.getDate("CD_TO_TIME1"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME2"), row.getDate("CD_TO_TIME2"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME3"), row.getDate("CD_TO_TIME3"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME4"), row.getDate("CD_TO_TIME4"))); exception.addRange(new DateRange(row.getDate("CD_FROM_TIME5"), row.getDate("CD_TO_TIME5"))); } }
[ "private", "void", "processCalendarException", "(", "ProjectCalendar", "calendar", ",", "Row", "row", ")", "{", "Date", "fromDate", "=", "row", ".", "getDate", "(", "\"CD_FROM_DATE\"", ")", ";", "Date", "toDate", "=", "row", ".", "getDate", "(", "\"CD_TO_DATE\...
Process a calendar exception. @param calendar parent calendar @param row calendar exception data
[ "Process", "a", "calendar", "exception", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L291-L305
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processCalendarHours
private void processCalendarHours(ProjectCalendar calendar, Row row, int dayIndex) { Day day = Day.getInstance(dayIndex); boolean working = row.getInt("CD_WORKING") != 0; calendar.setWorkingDay(day, working); if (working == true) { ProjectCalendarHours hours = calendar.addCalendarHours(day); Date start = row.getDate("CD_FROM_TIME1"); Date end = row.getDate("CD_TO_TIME1"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME2"); end = row.getDate("CD_TO_TIME2"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME3"); end = row.getDate("CD_TO_TIME3"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME4"); end = row.getDate("CD_TO_TIME4"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME5"); end = row.getDate("CD_TO_TIME5"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } } }
java
private void processCalendarHours(ProjectCalendar calendar, Row row, int dayIndex) { Day day = Day.getInstance(dayIndex); boolean working = row.getInt("CD_WORKING") != 0; calendar.setWorkingDay(day, working); if (working == true) { ProjectCalendarHours hours = calendar.addCalendarHours(day); Date start = row.getDate("CD_FROM_TIME1"); Date end = row.getDate("CD_TO_TIME1"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME2"); end = row.getDate("CD_TO_TIME2"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME3"); end = row.getDate("CD_TO_TIME3"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME4"); end = row.getDate("CD_TO_TIME4"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } start = row.getDate("CD_FROM_TIME5"); end = row.getDate("CD_TO_TIME5"); if (start != null && end != null) { hours.addRange(new DateRange(start, end)); } } }
[ "private", "void", "processCalendarHours", "(", "ProjectCalendar", "calendar", ",", "Row", "row", ",", "int", "dayIndex", ")", "{", "Day", "day", "=", "Day", ".", "getInstance", "(", "dayIndex", ")", ";", "boolean", "working", "=", "row", ".", "getInt", "(...
Process calendar hours. @param calendar parent calendar @param row calendar hours data @param dayIndex day index
[ "Process", "calendar", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L314-L358
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processResourceBaseline
protected void processResourceBaseline(Row row) { Integer id = row.getInteger("RES_UID"); Resource resource = m_project.getResourceByUniqueID(id); if (resource != null) { int index = row.getInt("RB_BASE_NUM"); resource.setBaselineWork(index, row.getDuration("RB_BASE_WORK")); resource.setBaselineCost(index, row.getCurrency("RB_BASE_COST")); } }
java
protected void processResourceBaseline(Row row) { Integer id = row.getInteger("RES_UID"); Resource resource = m_project.getResourceByUniqueID(id); if (resource != null) { int index = row.getInt("RB_BASE_NUM"); resource.setBaselineWork(index, row.getDuration("RB_BASE_WORK")); resource.setBaselineCost(index, row.getCurrency("RB_BASE_COST")); } }
[ "protected", "void", "processResourceBaseline", "(", "Row", "row", ")", "{", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"RES_UID\"", ")", ";", "Resource", "resource", "=", "m_project", ".", "getResourceByUniqueID", "(", "id", ")", ";", "if", "(",...
Read resource baseline values. @param row result set row
[ "Read", "resource", "baseline", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L634-L645
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processDurationField
protected void processDurationField(Row row) { processField(row, "DUR_FIELD_ID", "DUR_REF_UID", MPDUtility.getAdjustedDuration(m_project, row.getInt("DUR_VALUE"), MPDUtility.getDurationTimeUnits(row.getInt("DUR_FMT")))); }
java
protected void processDurationField(Row row) { processField(row, "DUR_FIELD_ID", "DUR_REF_UID", MPDUtility.getAdjustedDuration(m_project, row.getInt("DUR_VALUE"), MPDUtility.getDurationTimeUnits(row.getInt("DUR_FMT")))); }
[ "protected", "void", "processDurationField", "(", "Row", "row", ")", "{", "processField", "(", "row", ",", "\"DUR_FIELD_ID\"", ",", "\"DUR_REF_UID\"", ",", "MPDUtility", ".", "getAdjustedDuration", "(", "m_project", ",", "row", ".", "getInt", "(", "\"DUR_VALUE\"",...
Read a single duration field extended attribute. @param row field data
[ "Read", "a", "single", "duration", "field", "extended", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L682-L685
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processOutlineCodeField
protected void processOutlineCodeField(Integer entityID, Row row) { processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME")); }
java
protected void processOutlineCodeField(Integer entityID, Row row) { processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME")); }
[ "protected", "void", "processOutlineCodeField", "(", "Integer", "entityID", ",", "Row", "row", ")", "{", "processField", "(", "row", ",", "\"OC_FIELD_ID\"", ",", "entityID", ",", "row", ".", "getString", "(", "\"OC_NAME\"", ")", ")", ";", "}" ]
Read a single outline code field extended attribute. @param entityID parent entity @param row field data
[ "Read", "a", "single", "outline", "code", "field", "extended", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L703-L706
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processTaskBaseline
protected void processTaskBaseline(Row row) { Integer id = row.getInteger("TASK_UID"); Task task = m_project.getTaskByUniqueID(id); if (task != null) { int index = row.getInt("TB_BASE_NUM"); task.setBaselineDuration(index, MPDUtility.getAdjustedDuration(m_project, row.getInt("TB_BASE_DUR"), MPDUtility.getDurationTimeUnits(row.getInt("TB_BASE_DUR_FMT")))); task.setBaselineStart(index, row.getDate("TB_BASE_START")); task.setBaselineFinish(index, row.getDate("TB_BASE_FINISH")); task.setBaselineWork(index, row.getDuration("TB_BASE_WORK")); task.setBaselineCost(index, row.getCurrency("TB_BASE_COST")); } }
java
protected void processTaskBaseline(Row row) { Integer id = row.getInteger("TASK_UID"); Task task = m_project.getTaskByUniqueID(id); if (task != null) { int index = row.getInt("TB_BASE_NUM"); task.setBaselineDuration(index, MPDUtility.getAdjustedDuration(m_project, row.getInt("TB_BASE_DUR"), MPDUtility.getDurationTimeUnits(row.getInt("TB_BASE_DUR_FMT")))); task.setBaselineStart(index, row.getDate("TB_BASE_START")); task.setBaselineFinish(index, row.getDate("TB_BASE_FINISH")); task.setBaselineWork(index, row.getDuration("TB_BASE_WORK")); task.setBaselineCost(index, row.getCurrency("TB_BASE_COST")); } }
[ "protected", "void", "processTaskBaseline", "(", "Row", "row", ")", "{", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"TASK_UID\"", ")", ";", "Task", "task", "=", "m_project", ".", "getTaskByUniqueID", "(", "id", ")", ";", "if", "(", "task", "!...
Read task baseline values. @param row result set row
[ "Read", "task", "baseline", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1100-L1114
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processLink
protected void processLink(Row row) { Task predecessorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_PRED_UID")); Task successorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_SUCC_UID")); if (predecessorTask != null && successorTask != null) { RelationType type = RelationType.getInstance(row.getInt("LINK_TYPE")); TimeUnit durationUnits = MPDUtility.getDurationTimeUnits(row.getInt("LINK_LAG_FMT")); Duration duration = MPDUtility.getDuration(row.getDouble("LINK_LAG").doubleValue(), durationUnits); Relation relation = successorTask.addPredecessor(predecessorTask, type, duration); relation.setUniqueID(row.getInteger("LINK_UID")); m_eventManager.fireRelationReadEvent(relation); } }
java
protected void processLink(Row row) { Task predecessorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_PRED_UID")); Task successorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_SUCC_UID")); if (predecessorTask != null && successorTask != null) { RelationType type = RelationType.getInstance(row.getInt("LINK_TYPE")); TimeUnit durationUnits = MPDUtility.getDurationTimeUnits(row.getInt("LINK_LAG_FMT")); Duration duration = MPDUtility.getDuration(row.getDouble("LINK_LAG").doubleValue(), durationUnits); Relation relation = successorTask.addPredecessor(predecessorTask, type, duration); relation.setUniqueID(row.getInteger("LINK_UID")); m_eventManager.fireRelationReadEvent(relation); } }
[ "protected", "void", "processLink", "(", "Row", "row", ")", "{", "Task", "predecessorTask", "=", "m_project", ".", "getTaskByUniqueID", "(", "row", ".", "getInteger", "(", "\"LINK_PRED_UID\"", ")", ")", ";", "Task", "successorTask", "=", "m_project", ".", "get...
Process a relationship between two tasks. @param row relationship data
[ "Process", "a", "relationship", "between", "two", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1121-L1134
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.processAssignmentBaseline
protected void processAssignmentBaseline(Row row) { Integer id = row.getInteger("ASSN_UID"); ResourceAssignment assignment = m_assignmentMap.get(id); if (assignment != null) { int index = row.getInt("AB_BASE_NUM"); assignment.setBaselineStart(index, row.getDate("AB_BASE_START")); assignment.setBaselineFinish(index, row.getDate("AB_BASE_FINISH")); assignment.setBaselineWork(index, row.getDuration("AB_BASE_WORK")); assignment.setBaselineCost(index, row.getCurrency("AB_BASE_COST")); } }
java
protected void processAssignmentBaseline(Row row) { Integer id = row.getInteger("ASSN_UID"); ResourceAssignment assignment = m_assignmentMap.get(id); if (assignment != null) { int index = row.getInt("AB_BASE_NUM"); assignment.setBaselineStart(index, row.getDate("AB_BASE_START")); assignment.setBaselineFinish(index, row.getDate("AB_BASE_FINISH")); assignment.setBaselineWork(index, row.getDuration("AB_BASE_WORK")); assignment.setBaselineCost(index, row.getCurrency("AB_BASE_COST")); } }
[ "protected", "void", "processAssignmentBaseline", "(", "Row", "row", ")", "{", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"ASSN_UID\"", ")", ";", "ResourceAssignment", "assignment", "=", "m_assignmentMap", ".", "get", "(", "id", ")", ";", "if", "...
Read resource assignment baseline values. @param row result set row
[ "Read", "resource", "assignment", "baseline", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1217-L1230
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.postProcessing
protected void postProcessing() { // // Update the internal structure. We'll take this opportunity to // generate outline numbers for the tasks as they don't appear to // be present in the MPP file. // ProjectConfig config = m_project.getProjectConfig(); config.setAutoWBS(m_autoWBS); config.setAutoOutlineNumber(true); m_project.updateStructure(); config.setAutoOutlineNumber(false); // // Perform post-processing to set the summary flag // for (Task task : m_project.getTasks()) { task.setSummary(task.hasChildTasks()); } // // Ensure that the unique ID counters are correct // config.updateUniqueCounters(); }
java
protected void postProcessing() { // // Update the internal structure. We'll take this opportunity to // generate outline numbers for the tasks as they don't appear to // be present in the MPP file. // ProjectConfig config = m_project.getProjectConfig(); config.setAutoWBS(m_autoWBS); config.setAutoOutlineNumber(true); m_project.updateStructure(); config.setAutoOutlineNumber(false); // // Perform post-processing to set the summary flag // for (Task task : m_project.getTasks()) { task.setSummary(task.hasChildTasks()); } // // Ensure that the unique ID counters are correct // config.updateUniqueCounters(); }
[ "protected", "void", "postProcessing", "(", ")", "{", "//", "// Update the internal structure. We'll take this opportunity to", "// generate outline numbers for the tasks as they don't appear to", "// be present in the MPP file.", "//", "ProjectConfig", "config", "=", "m_project", ".",...
Carry out any post-processing required to tidy up the data read from the database.
[ "Carry", "out", "any", "post", "-", "processing", "required", "to", "tidy", "up", "the", "data", "read", "from", "the", "database", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1236-L1261
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java
MPD9AbstractReader.getNullOnValue
private Integer getNullOnValue(Integer value, int nullValue) { return (NumberHelper.getInt(value) == nullValue ? null : value); }
java
private Integer getNullOnValue(Integer value, int nullValue) { return (NumberHelper.getInt(value) == nullValue ? null : value); }
[ "private", "Integer", "getNullOnValue", "(", "Integer", "value", ",", "int", "nullValue", ")", "{", "return", "(", "NumberHelper", ".", "getInt", "(", "value", ")", "==", "nullValue", "?", "null", ":", "value", ")", ";", "}" ]
This method returns the value it is passed, or null if the value matches the nullValue argument. @param value value under test @param nullValue return null if value under test matches this value @return value or null
[ "This", "method", "returns", "the", "value", "it", "is", "passed", "or", "null", "if", "the", "value", "matches", "the", "nullValue", "argument", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1283-L1286
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/ConstraintFactory.java
ConstraintFactory.process
public void process(DirectoryEntry projectDir, ProjectFile file, DocumentInputStreamFactory inputStreamFactory) throws IOException { DirectoryEntry consDir; try { consDir = (DirectoryEntry) projectDir.getEntry("TBkndCons"); } catch (FileNotFoundException ex) { consDir = null; } if (consDir != null) { FixedMeta consFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) consDir.getEntry("FixedMeta"))), 10); FixedData consFixedData = new FixedData(consFixedMeta, 20, inputStreamFactory.getInstance(consDir, "FixedData")); // FixedMeta consFixed2Meta = new FixedMeta(new DocumentInputStream(((DocumentEntry) consDir.getEntry("Fixed2Meta"))), 9); // FixedData consFixed2Data = new FixedData(consFixed2Meta, 48, getEncryptableInputStream(consDir, "Fixed2Data")); int count = consFixedMeta.getAdjustedItemCount(); int lastConstraintID = -1; ProjectProperties properties = file.getProjectProperties(); EventManager eventManager = file.getEventManager(); boolean project15 = NumberHelper.getInt(properties.getMppFileType()) == 14 && NumberHelper.getInt(properties.getApplicationVersion()) > ApplicationVersion.PROJECT_2010; int durationUnitsOffset = project15 ? 18 : 14; int durationOffset = project15 ? 14 : 16; for (int loop = 0; loop < count; loop++) { byte[] metaData = consFixedMeta.getByteArrayValue(loop); // // SourceForge bug 2209477: we were reading an int here, but // it looks like the deleted flag is just a short. // if (MPPUtility.getShort(metaData, 0) != 0) { continue; } int index = consFixedData.getIndexFromOffset(MPPUtility.getInt(metaData, 4)); if (index == -1) { continue; } // // Do we have enough data? // byte[] data = consFixedData.getByteArrayValue(index); if (data.length < 14) { continue; } int constraintID = MPPUtility.getInt(data, 0); if (constraintID <= lastConstraintID) { continue; } lastConstraintID = constraintID; int taskID1 = MPPUtility.getInt(data, 4); int taskID2 = MPPUtility.getInt(data, 8); if (taskID1 == taskID2) { continue; } // byte[] metaData2 = consFixed2Meta.getByteArrayValue(loop); // int index2 = consFixed2Data.getIndexFromOffset(MPPUtility.getInt(metaData2, 4)); // byte[] data2 = consFixed2Data.getByteArrayValue(index2); Task task1 = file.getTaskByUniqueID(Integer.valueOf(taskID1)); Task task2 = file.getTaskByUniqueID(Integer.valueOf(taskID2)); if (task1 != null && task2 != null) { RelationType type = RelationType.getInstance(MPPUtility.getShort(data, 12)); TimeUnit durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, durationUnitsOffset)); Duration lag = MPPUtility.getAdjustedDuration(properties, MPPUtility.getInt(data, durationOffset), durationUnits); Relation relation = task2.addPredecessor(task1, type, lag); relation.setUniqueID(Integer.valueOf(constraintID)); eventManager.fireRelationReadEvent(relation); } } } }
java
public void process(DirectoryEntry projectDir, ProjectFile file, DocumentInputStreamFactory inputStreamFactory) throws IOException { DirectoryEntry consDir; try { consDir = (DirectoryEntry) projectDir.getEntry("TBkndCons"); } catch (FileNotFoundException ex) { consDir = null; } if (consDir != null) { FixedMeta consFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) consDir.getEntry("FixedMeta"))), 10); FixedData consFixedData = new FixedData(consFixedMeta, 20, inputStreamFactory.getInstance(consDir, "FixedData")); // FixedMeta consFixed2Meta = new FixedMeta(new DocumentInputStream(((DocumentEntry) consDir.getEntry("Fixed2Meta"))), 9); // FixedData consFixed2Data = new FixedData(consFixed2Meta, 48, getEncryptableInputStream(consDir, "Fixed2Data")); int count = consFixedMeta.getAdjustedItemCount(); int lastConstraintID = -1; ProjectProperties properties = file.getProjectProperties(); EventManager eventManager = file.getEventManager(); boolean project15 = NumberHelper.getInt(properties.getMppFileType()) == 14 && NumberHelper.getInt(properties.getApplicationVersion()) > ApplicationVersion.PROJECT_2010; int durationUnitsOffset = project15 ? 18 : 14; int durationOffset = project15 ? 14 : 16; for (int loop = 0; loop < count; loop++) { byte[] metaData = consFixedMeta.getByteArrayValue(loop); // // SourceForge bug 2209477: we were reading an int here, but // it looks like the deleted flag is just a short. // if (MPPUtility.getShort(metaData, 0) != 0) { continue; } int index = consFixedData.getIndexFromOffset(MPPUtility.getInt(metaData, 4)); if (index == -1) { continue; } // // Do we have enough data? // byte[] data = consFixedData.getByteArrayValue(index); if (data.length < 14) { continue; } int constraintID = MPPUtility.getInt(data, 0); if (constraintID <= lastConstraintID) { continue; } lastConstraintID = constraintID; int taskID1 = MPPUtility.getInt(data, 4); int taskID2 = MPPUtility.getInt(data, 8); if (taskID1 == taskID2) { continue; } // byte[] metaData2 = consFixed2Meta.getByteArrayValue(loop); // int index2 = consFixed2Data.getIndexFromOffset(MPPUtility.getInt(metaData2, 4)); // byte[] data2 = consFixed2Data.getByteArrayValue(index2); Task task1 = file.getTaskByUniqueID(Integer.valueOf(taskID1)); Task task2 = file.getTaskByUniqueID(Integer.valueOf(taskID2)); if (task1 != null && task2 != null) { RelationType type = RelationType.getInstance(MPPUtility.getShort(data, 12)); TimeUnit durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, durationUnitsOffset)); Duration lag = MPPUtility.getAdjustedDuration(properties, MPPUtility.getInt(data, durationOffset), durationUnits); Relation relation = task2.addPredecessor(task1, type, lag); relation.setUniqueID(Integer.valueOf(constraintID)); eventManager.fireRelationReadEvent(relation); } } } }
[ "public", "void", "process", "(", "DirectoryEntry", "projectDir", ",", "ProjectFile", "file", ",", "DocumentInputStreamFactory", "inputStreamFactory", ")", "throws", "IOException", "{", "DirectoryEntry", "consDir", ";", "try", "{", "consDir", "=", "(", "DirectoryEntry...
Main entry point when called to process constraint data. @param projectDir project directory @param file parent project file @param inputStreamFactory factory to create input stream
[ "Main", "entry", "point", "when", "called", "to", "process", "constraint", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ConstraintFactory.java#L34-L124
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/TextFileRow.java
TextFileRow.getColumnValue
private Object getColumnValue(String table, String column, String data, int type, boolean epochDateFormat) throws MPXJException { try { Object value = null; switch (type) { case Types.BIT: { value = DatatypeConverter.parseBoolean(data); break; } case Types.VARCHAR: case Types.LONGVARCHAR: { value = DatatypeConverter.parseString(data); break; } case Types.TIME: { value = DatatypeConverter.parseBasicTime(data); break; } case Types.TIMESTAMP: { if (epochDateFormat) { value = DatatypeConverter.parseEpochTimestamp(data); } else { value = DatatypeConverter.parseBasicTimestamp(data); } break; } case Types.DOUBLE: { value = DatatypeConverter.parseDouble(data); break; } case Types.INTEGER: { value = DatatypeConverter.parseInteger(data); break; } default: { throw new IllegalArgumentException("Unsupported SQL type: " + type); } } return value; } catch (Exception ex) { throw new MPXJException("Failed to parse " + table + "." + column + " (data=" + data + ", type=" + type + ")", ex); } }
java
private Object getColumnValue(String table, String column, String data, int type, boolean epochDateFormat) throws MPXJException { try { Object value = null; switch (type) { case Types.BIT: { value = DatatypeConverter.parseBoolean(data); break; } case Types.VARCHAR: case Types.LONGVARCHAR: { value = DatatypeConverter.parseString(data); break; } case Types.TIME: { value = DatatypeConverter.parseBasicTime(data); break; } case Types.TIMESTAMP: { if (epochDateFormat) { value = DatatypeConverter.parseEpochTimestamp(data); } else { value = DatatypeConverter.parseBasicTimestamp(data); } break; } case Types.DOUBLE: { value = DatatypeConverter.parseDouble(data); break; } case Types.INTEGER: { value = DatatypeConverter.parseInteger(data); break; } default: { throw new IllegalArgumentException("Unsupported SQL type: " + type); } } return value; } catch (Exception ex) { throw new MPXJException("Failed to parse " + table + "." + column + " (data=" + data + ", type=" + type + ")", ex); } }
[ "private", "Object", "getColumnValue", "(", "String", "table", ",", "String", "column", ",", "String", "data", ",", "int", "type", ",", "boolean", "epochDateFormat", ")", "throws", "MPXJException", "{", "try", "{", "Object", "value", "=", "null", ";", "switc...
Maps the text representation of column data to Java types. @param table table name @param column column name @param data text representation of column data @param type column data type @param epochDateFormat true if date is represented as an offset from an epoch @return Java representation of column data @throws MPXJException
[ "Maps", "the", "text", "representation", "of", "column", "data", "to", "Java", "types", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/TextFileRow.java#L75-L140
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/schema/Callouts.java
Callouts.getCallout
public List<Callouts.Callout> getCallout() { if (callout == null) { callout = new ArrayList<Callouts.Callout>(); } return this.callout; }
java
public List<Callouts.Callout> getCallout() { if (callout == null) { callout = new ArrayList<Callouts.Callout>(); } return this.callout; }
[ "public", "List", "<", "Callouts", ".", "Callout", ">", "getCallout", "(", ")", "{", "if", "(", "callout", "==", "null", ")", "{", "callout", "=", "new", "ArrayList", "<", "Callouts", ".", "Callout", ">", "(", ")", ";", "}", "return", "this", ".", ...
Gets the value of the callout property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the callout property. <p> For example, to add a new item, do as follows: <pre> getCallout().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link Callouts.Callout }
[ "Gets", "the", "value", "of", "the", "callout", "property", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/schema/Callouts.java#L83-L90
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java
DatatypeConverter.parseMinutesFromHours
public static final Integer parseMinutesFromHours(String value) { Integer result = null; if (value != null) { result = Integer.valueOf(Integer.parseInt(value) * 60); } return result; }
java
public static final Integer parseMinutesFromHours(String value) { Integer result = null; if (value != null) { result = Integer.valueOf(Integer.parseInt(value) * 60); } return result; }
[ "public", "static", "final", "Integer", "parseMinutesFromHours", "(", "String", "value", ")", "{", "Integer", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "result", "=", "Integer", ".", "valueOf", "(", "Integer", ".", "parseInt",...
Parse a duration in minutes form a number of hours. @param value String representation @return Integer instance
[ "Parse", "a", "duration", "in", "minutes", "form", "a", "number", "of", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java#L118-L126
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java
DatatypeConverter.parseCurrencySymbolPosition
public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value) { CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION.get(value); result = result == null ? CurrencySymbolPosition.BEFORE_WITH_SPACE : result; return result; }
java
public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value) { CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION.get(value); result = result == null ? CurrencySymbolPosition.BEFORE_WITH_SPACE : result; return result; }
[ "public", "static", "final", "CurrencySymbolPosition", "parseCurrencySymbolPosition", "(", "String", "value", ")", "{", "CurrencySymbolPosition", "result", "=", "MAP_TO_CURRENCY_SYMBOL_POSITION", ".", "get", "(", "value", ")", ";", "result", "=", "result", "==", "null...
Parse a currency symbol position from a string representation. @param value String representation @return CurrencySymbolPosition instance
[ "Parse", "a", "currency", "symbol", "position", "from", "a", "string", "representation", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java#L145-L150
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java
DatatypeConverter.parseDate
public static final Date parseDate(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_FORMAT.get().parse(value); } } catch (ParseException ex) { // Ignore } return result; }
java
public static final Date parseDate(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_FORMAT.get().parse(value); } } catch (ParseException ex) { // Ignore } return result; }
[ "public", "static", "final", "Date", "parseDate", "(", "String", "value", ")", "{", "Date", "result", "=", "null", ";", "try", "{", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "DATE_FORMAT"...
Parse a date value. @param value String representation @return Date instance
[ "Parse", "a", "date", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java#L227-L244
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java
DatatypeConverter.parseDateTime
public static final Date parseDateTime(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_TIME_FORMAT.get().parse(value); } } catch (ParseException ex) { // Ignore } return result; }
java
public static final Date parseDateTime(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_TIME_FORMAT.get().parse(value); } } catch (ParseException ex) { // Ignore } return result; }
[ "public", "static", "final", "Date", "parseDateTime", "(", "String", "value", ")", "{", "Date", "result", "=", "null", ";", "try", "{", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "DATE_TIM...
Parse a date time value. @param value String representation @return Date instance
[ "Parse", "a", "date", "time", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/DatatypeConverter.java#L263-L280
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/PEPUtility.java
PEPUtility.getInt
public static final int getInt(byte[] data, int offset) { int result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
public static final int getInt(byte[] data, int offset) { int result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "public", "static", "final", "int", "getInt", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "result", "=", "0", ";", "int", "i", "=", "offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "32", ";", ...
Read a four byte integer. @param data byte array @param offset offset into array @return integer value
[ "Read", "a", "four", "byte", "integer", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/PEPUtility.java#L42-L52
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/PEPUtility.java
PEPUtility.getShort
public static final int getShort(byte[] data, int offset) { int result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 16; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
public static final int getShort(byte[] data, int offset) { int result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 16; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "public", "static", "final", "int", "getShort", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "result", "=", "0", ";", "int", "i", "=", "offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "16", ";",...
Read a two byte integer. @param data byte array @param offset offset into array @return integer value
[ "Read", "a", "two", "byte", "integer", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/PEPUtility.java#L61-L71
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/PEPUtility.java
PEPUtility.getString
public static final String getString(byte[] data, int offset) { return getString(data, offset, data.length - offset); }
java
public static final String getString(byte[] data, int offset) { return getString(data, offset, data.length - offset); }
[ "public", "static", "final", "String", "getString", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "return", "getString", "(", "data", ",", "offset", ",", "data", ".", "length", "-", "offset", ")", ";", "}" ]
Retrieve a string value. @param data byte array @param offset offset into byte array @return string value
[ "Retrieve", "a", "string", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/PEPUtility.java#L80-L83
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/PEPUtility.java
PEPUtility.getFinishDate
public static final Date getFinishDate(byte[] data, int offset) { Date result; long days = getShort(data, offset); if (days == 0x8000) { result = null; } else { result = DateHelper.getDateFromLong(EPOCH + ((days - 1) * DateHelper.MS_PER_DAY)); } return (result); }
java
public static final Date getFinishDate(byte[] data, int offset) { Date result; long days = getShort(data, offset); if (days == 0x8000) { result = null; } else { result = DateHelper.getDateFromLong(EPOCH + ((days - 1) * DateHelper.MS_PER_DAY)); } return (result); }
[ "public", "static", "final", "Date", "getFinishDate", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Date", "result", ";", "long", "days", "=", "getShort", "(", "data", ",", "offset", ")", ";", "if", "(", "days", "==", "0x8000", ")",...
Retrieve a finish date. @param data byte array @param offset offset into byte array @return finish date
[ "Retrieve", "a", "finish", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/PEPUtility.java#L144-L159
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.setDefaultCalendarName
public void setDefaultCalendarName(String calendarName) { if (calendarName == null || calendarName.length() == 0) { calendarName = DEFAULT_CALENDAR_NAME; } set(ProjectField.DEFAULT_CALENDAR_NAME, calendarName); }
java
public void setDefaultCalendarName(String calendarName) { if (calendarName == null || calendarName.length() == 0) { calendarName = DEFAULT_CALENDAR_NAME; } set(ProjectField.DEFAULT_CALENDAR_NAME, calendarName); }
[ "public", "void", "setDefaultCalendarName", "(", "String", "calendarName", ")", "{", "if", "(", "calendarName", "==", "null", "||", "calendarName", ".", "length", "(", ")", "==", "0", ")", "{", "calendarName", "=", "DEFAULT_CALENDAR_NAME", ";", "}", "set", "...
Sets the Calendar used. 'Standard' if no value is set. @param calendarName Calendar name
[ "Sets", "the", "Calendar", "used", ".", "Standard", "if", "no", "value", "is", "set", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L566-L574
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getStartDate
public Date getStartDate() { Date result = (Date) getCachedValue(ProjectField.START_DATE); if (result == null) { result = getParentFile().getStartDate(); } return (result); }
java
public Date getStartDate() { Date result = (Date) getCachedValue(ProjectField.START_DATE); if (result == null) { result = getParentFile().getStartDate(); } return (result); }
[ "public", "Date", "getStartDate", "(", ")", "{", "Date", "result", "=", "(", "Date", ")", "getCachedValue", "(", "ProjectField", ".", "START_DATE", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getParentFile", "(", ")", ".", "g...
Retrieves the project start date. If an explicit start date has not been set, this method calculates the start date by looking for the earliest task start date. @return project start date
[ "Retrieves", "the", "project", "start", "date", ".", "If", "an", "explicit", "start", "date", "has", "not", "been", "set", "this", "method", "calculates", "the", "start", "date", "by", "looking", "for", "the", "earliest", "task", "start", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L603-L611
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getFinishDate
public Date getFinishDate() { Date result = (Date) getCachedValue(ProjectField.FINISH_DATE); if (result == null) { result = getParentFile().getFinishDate(); } return (result); }
java
public Date getFinishDate() { Date result = (Date) getCachedValue(ProjectField.FINISH_DATE); if (result == null) { result = getParentFile().getFinishDate(); } return (result); }
[ "public", "Date", "getFinishDate", "(", ")", "{", "Date", "result", "=", "(", "Date", ")", "getCachedValue", "(", "ProjectField", ".", "FINISH_DATE", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getParentFile", "(", ")", ".", ...
Retrieves the project finish date. If an explicit finish date has not been set, this method calculates the finish date by looking for the latest task finish date. @return Finish Date
[ "Retrieves", "the", "project", "finish", "date", ".", "If", "an", "explicit", "finish", "date", "has", "not", "been", "set", "this", "method", "calculates", "the", "finish", "date", "by", "looking", "for", "the", "latest", "task", "finish", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L620-L628
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.setCurrencySymbol
public void setCurrencySymbol(String symbol) { if (symbol == null) { symbol = DEFAULT_CURRENCY_SYMBOL; } set(ProjectField.CURRENCY_SYMBOL, symbol); }
java
public void setCurrencySymbol(String symbol) { if (symbol == null) { symbol = DEFAULT_CURRENCY_SYMBOL; } set(ProjectField.CURRENCY_SYMBOL, symbol); }
[ "public", "void", "setCurrencySymbol", "(", "String", "symbol", ")", "{", "if", "(", "symbol", "==", "null", ")", "{", "symbol", "=", "DEFAULT_CURRENCY_SYMBOL", ";", "}", "set", "(", "ProjectField", ".", "CURRENCY_SYMBOL", ",", "symbol", ")", ";", "}" ]
Sets currency symbol. @param symbol currency symbol
[ "Sets", "currency", "symbol", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L1107-L1115
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.setSymbolPosition
public void setSymbolPosition(CurrencySymbolPosition posn) { if (posn == null) { posn = DEFAULT_CURRENCY_SYMBOL_POSITION; } set(ProjectField.CURRENCY_SYMBOL_POSITION, posn); }
java
public void setSymbolPosition(CurrencySymbolPosition posn) { if (posn == null) { posn = DEFAULT_CURRENCY_SYMBOL_POSITION; } set(ProjectField.CURRENCY_SYMBOL_POSITION, posn); }
[ "public", "void", "setSymbolPosition", "(", "CurrencySymbolPosition", "posn", ")", "{", "if", "(", "posn", "==", "null", ")", "{", "posn", "=", "DEFAULT_CURRENCY_SYMBOL_POSITION", ";", "}", "set", "(", "ProjectField", ".", "CURRENCY_SYMBOL_POSITION", ",", "posn", ...
Sets the position of the currency symbol. @param posn currency symbol position.
[ "Sets", "the", "position", "of", "the", "currency", "symbol", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L1132-L1139
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.setCurrencyDigits
public void setCurrencyDigits(Integer currDigs) { if (currDigs == null) { currDigs = DEFAULT_CURRENCY_DIGITS; } set(ProjectField.CURRENCY_DIGITS, currDigs); }
java
public void setCurrencyDigits(Integer currDigs) { if (currDigs == null) { currDigs = DEFAULT_CURRENCY_DIGITS; } set(ProjectField.CURRENCY_DIGITS, currDigs); }
[ "public", "void", "setCurrencyDigits", "(", "Integer", "currDigs", ")", "{", "if", "(", "currDigs", "==", "null", ")", "{", "currDigs", "=", "DEFAULT_CURRENCY_DIGITS", ";", "}", "set", "(", "ProjectField", ".", "CURRENCY_DIGITS", ",", "currDigs", ")", ";", "...
Sets no of currency digits. @param currDigs Available values, 0,1,2
[ "Sets", "no", "of", "currency", "digits", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L1156-L1163
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getMinutesPerMonth
public Number getMinutesPerMonth() { return Integer.valueOf(NumberHelper.getInt(getMinutesPerDay()) * NumberHelper.getInt(getDaysPerMonth())); }
java
public Number getMinutesPerMonth() { return Integer.valueOf(NumberHelper.getInt(getMinutesPerDay()) * NumberHelper.getInt(getDaysPerMonth())); }
[ "public", "Number", "getMinutesPerMonth", "(", ")", "{", "return", "Integer", ".", "valueOf", "(", "NumberHelper", ".", "getInt", "(", "getMinutesPerDay", "(", ")", ")", "*", "NumberHelper", ".", "getInt", "(", "getDaysPerMonth", "(", ")", ")", ")", ";", "...
Retrieve the default number of minutes per month. @return minutes per month
[ "Retrieve", "the", "default", "number", "of", "minutes", "per", "month", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L1337-L1340
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getMinutesPerYear
public Number getMinutesPerYear() { return Integer.valueOf(NumberHelper.getInt(getMinutesPerDay()) * NumberHelper.getInt(getDaysPerMonth()) * 12); }
java
public Number getMinutesPerYear() { return Integer.valueOf(NumberHelper.getInt(getMinutesPerDay()) * NumberHelper.getInt(getDaysPerMonth()) * 12); }
[ "public", "Number", "getMinutesPerYear", "(", ")", "{", "return", "Integer", ".", "valueOf", "(", "NumberHelper", ".", "getInt", "(", "getMinutesPerDay", "(", ")", ")", "*", "NumberHelper", ".", "getInt", "(", "getDaysPerMonth", "(", ")", ")", "*", "12", "...
Retrieve the default number of minutes per year. @return minutes per year
[ "Retrieve", "the", "default", "number", "of", "minutes", "per", "year", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L1347-L1350
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getCustomProperties
@SuppressWarnings("unchecked") public Map<String, Object> getCustomProperties() { return (Map<String, Object>) getCachedValue(ProjectField.CUSTOM_PROPERTIES); }
java
@SuppressWarnings("unchecked") public Map<String, Object> getCustomProperties() { return (Map<String, Object>) getCachedValue(ProjectField.CUSTOM_PROPERTIES); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Map", "<", "String", ",", "Object", ">", "getCustomProperties", "(", ")", "{", "return", "(", "Map", "<", "String", ",", "Object", ">", ")", "getCachedValue", "(", "ProjectField", ".", "CUSTOM_PR...
Retrieve a map of custom document properties. @return the Document Summary Information Map
[ "Retrieve", "a", "map", "of", "custom", "document", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2111-L2114
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getCachedCharValue
private char getCachedCharValue(FieldType field, char defaultValue) { Character c = (Character) getCachedValue(field); return c == null ? defaultValue : c.charValue(); }
java
private char getCachedCharValue(FieldType field, char defaultValue) { Character c = (Character) getCachedValue(field); return c == null ? defaultValue : c.charValue(); }
[ "private", "char", "getCachedCharValue", "(", "FieldType", "field", ",", "char", "defaultValue", ")", "{", "Character", "c", "=", "(", "Character", ")", "getCachedValue", "(", "field", ")", ";", "return", "c", "==", "null", "?", "defaultValue", ":", "c", "...
Handles retrieval of primitive char type. @param field required field @param defaultValue default value if field is missing @return char value
[ "Handles", "retrieval", "of", "primitive", "char", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2690-L2694
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.set
private void set(FieldType field, boolean value) { set(field, (value ? Boolean.TRUE : Boolean.FALSE)); }
java
private void set(FieldType field, boolean value) { set(field, (value ? Boolean.TRUE : Boolean.FALSE)); }
[ "private", "void", "set", "(", "FieldType", "field", ",", "boolean", "value", ")", "{", "set", "(", "field", ",", "(", "value", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ")", ")", ";", "}" ]
This method inserts a name value pair into internal storage. @param field task field @param value attribute value
[ "This", "method", "inserts", "a", "name", "value", "pair", "into", "internal", "storage", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2730-L2733
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java
AstaDatabaseReader.getRows
private List<Row> getRows(String sql) throws SQLException { allocateConnection(); try { List<Row> result = new LinkedList<Row>(); m_ps = m_connection.prepareStatement(sql); m_rs = m_ps.executeQuery(); populateMetaData(); while (m_rs.next()) { result.add(new MpdResultSetRow(m_rs, m_meta)); } return (result); } finally { releaseConnection(); } }
java
private List<Row> getRows(String sql) throws SQLException { allocateConnection(); try { List<Row> result = new LinkedList<Row>(); m_ps = m_connection.prepareStatement(sql); m_rs = m_ps.executeQuery(); populateMetaData(); while (m_rs.next()) { result.add(new MpdResultSetRow(m_rs, m_meta)); } return (result); } finally { releaseConnection(); } }
[ "private", "List", "<", "Row", ">", "getRows", "(", "String", "sql", ")", "throws", "SQLException", "{", "allocateConnection", "(", ")", ";", "try", "{", "List", "<", "Row", ">", "result", "=", "new", "LinkedList", "<", "Row", ">", "(", ")", ";", "m_...
Retrieve a number of rows matching the supplied query. @param sql query statement @return result set @throws SQLException
[ "Retrieve", "a", "number", "of", "rows", "matching", "the", "supplied", "query", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L362-L385
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java
AstaDatabaseReader.releaseConnection
private void releaseConnection() { if (m_rs != null) { try { m_rs.close(); } catch (SQLException ex) { // silently ignore errors on close } m_rs = null; } if (m_ps != null) { try { m_ps.close(); } catch (SQLException ex) { // silently ignore errors on close } m_ps = null; } }
java
private void releaseConnection() { if (m_rs != null) { try { m_rs.close(); } catch (SQLException ex) { // silently ignore errors on close } m_rs = null; } if (m_ps != null) { try { m_ps.close(); } catch (SQLException ex) { // silently ignore errors on close } m_ps = null; } }
[ "private", "void", "releaseConnection", "(", ")", "{", "if", "(", "m_rs", "!=", "null", ")", "{", "try", "{", "m_rs", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "ex", ")", "{", "// silently ignore errors on close", "}", "m_rs", "=", ...
Releases a database connection, and cleans up any resources associated with that connection.
[ "Releases", "a", "database", "connection", "and", "cleans", "up", "any", "resources", "associated", "with", "that", "connection", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L440-L471
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java
AstaDatabaseReader.populateMetaData
private void populateMetaData() throws SQLException { m_meta.clear(); ResultSetMetaData meta = m_rs.getMetaData(); int columnCount = meta.getColumnCount() + 1; for (int loop = 1; loop < columnCount; loop++) { String name = meta.getColumnName(loop); Integer type = Integer.valueOf(meta.getColumnType(loop)); m_meta.put(name, type); } }
java
private void populateMetaData() throws SQLException { m_meta.clear(); ResultSetMetaData meta = m_rs.getMetaData(); int columnCount = meta.getColumnCount() + 1; for (int loop = 1; loop < columnCount; loop++) { String name = meta.getColumnName(loop); Integer type = Integer.valueOf(meta.getColumnType(loop)); m_meta.put(name, type); } }
[ "private", "void", "populateMetaData", "(", ")", "throws", "SQLException", "{", "m_meta", ".", "clear", "(", ")", ";", "ResultSetMetaData", "meta", "=", "m_rs", ".", "getMetaData", "(", ")", ";", "int", "columnCount", "=", "meta", ".", "getColumnCount", "(",...
Retrieves basic meta data from the result set. @throws SQLException
[ "Retrieves", "basic", "meta", "data", "from", "the", "result", "set", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L478-L490
train
joniles/mpxj
src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java
AstaDatabaseReader.setSchema
public void setSchema(String schema) { if (schema.charAt(schema.length() - 1) != '.') { schema = schema + '.'; } m_schema = schema; }
java
public void setSchema(String schema) { if (schema.charAt(schema.length() - 1) != '.') { schema = schema + '.'; } m_schema = schema; }
[ "public", "void", "setSchema", "(", "String", "schema", ")", "{", "if", "(", "schema", ".", "charAt", "(", "schema", ".", "length", "(", ")", "-", "1", ")", "!=", "'", "'", ")", "{", "schema", "=", "schema", "+", "'", "'", ";", "}", "m_schema", ...
Set the name of the schema containing the schedule tables. @param schema schema name.
[ "Set", "the", "name", "of", "the", "schema", "containing", "the", "schedule", "tables", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L497-L504
train
joniles/mpxj
src/main/java/net/sf/mpxj/ActivityCode.java
ActivityCode.addValue
public ActivityCodeValue addValue(Integer uniqueID, String name, String description) { ActivityCodeValue value = new ActivityCodeValue(this, uniqueID, name, description); m_values.add(value); return value; }
java
public ActivityCodeValue addValue(Integer uniqueID, String name, String description) { ActivityCodeValue value = new ActivityCodeValue(this, uniqueID, name, description); m_values.add(value); return value; }
[ "public", "ActivityCodeValue", "addValue", "(", "Integer", "uniqueID", ",", "String", "name", ",", "String", "description", ")", "{", "ActivityCodeValue", "value", "=", "new", "ActivityCodeValue", "(", "this", ",", "uniqueID", ",", "name", ",", "description", ")...
Add a value to this activity code. @param uniqueID value unique ID @param name value name @param description value description @return ActivityCodeValue instance
[ "Add", "a", "value", "to", "this", "activity", "code", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ActivityCode.java#L75-L80
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getLong
public static final long getLong(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 64; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
public static final long getLong(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 64; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "public", "static", "final", "long", "getLong", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "long", "result", "=", "0", ";", "int", "i", "=", "offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "64", ";"...
Read a long int from a byte array. @param data byte array @param offset start offset @return long value
[ "Read", "a", "long", "int", "from", "a", "byte", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L114-L124
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getInt
public static final int getInt(InputStream is) throws IOException { byte[] data = new byte[4]; is.read(data); return getInt(data, 0); }
java
public static final int getInt(InputStream is) throws IOException { byte[] data = new byte[4]; is.read(data); return getInt(data, 0); }
[ "public", "static", "final", "int", "getInt", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "4", "]", ";", "is", ".", "read", "(", "data", ")", ";", "return", "getInt", "(", "data", ...
Read an int from an input stream. @param is input stream @return int value
[ "Read", "an", "int", "from", "an", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L132-L137
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getShort
public static final int getShort(InputStream is) throws IOException { byte[] data = new byte[2]; is.read(data); return getShort(data, 0); }
java
public static final int getShort(InputStream is) throws IOException { byte[] data = new byte[2]; is.read(data); return getShort(data, 0); }
[ "public", "static", "final", "int", "getShort", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "2", "]", ";", "is", ".", "read", "(", "data", ")", ";", "return", "getShort", "(", "data"...
Read a short int from an input stream. @param is input stream @return int value
[ "Read", "a", "short", "int", "from", "an", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L156-L161
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getLong
public static final long getLong(InputStream is) throws IOException { byte[] data = new byte[8]; is.read(data); return getLong(data, 0); }
java
public static final long getLong(InputStream is) throws IOException { byte[] data = new byte[8]; is.read(data); return getLong(data, 0); }
[ "public", "static", "final", "long", "getLong", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "8", "]", ";", "is", ".", "read", "(", "data", ")", ";", "return", "getLong", "(", "data",...
Read a long int from an input stream. @param is input stream @return long value
[ "Read", "a", "long", "int", "from", "an", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L169-L174
train